Brock Hensley
Brock Hensley

Reputation: 3645

Visual Studio 2012 Deploying WPF via ClickOnce missing Files

I have a WPF project that I am ready to deploy using Visual Studio 2012 but I'm running into missing file issues. I've searched for hours to find nothing but incorrect information about VS2k12 not even having ClickOnce support to it being a bug in VS that was claimed to be fixed in an update but people still complain the update didn't fix it.

If I Start the project in VS it runs fine and my test button works as expected.

When I Publish the project, the publish succeeds, running setup.exe installs successfully and program starts to main window fine.

Clicking test button crashes the application on a FileNotFoundException.

Line that causes crash:
streamReader = new StreamReader("ReceiptTemplates/templates.xml");

FileNotFoundException:

Could not find file C:\Users\dirt\AppData\Local\Apps\2.0\GEDD6PQW.N72\8M9ONPGG.TVB\prof..tion_40c30d08e677b188_0001.0000_985901e6c8ad767f\ ReceiptTemplates\templates.xml'.

Exists:
C:\MyProject\bin\MyMode\ReceiptTemplates\templates.xml

Confirmed Does Not Exist: C:\Users\dirt\AppData\Local\Apps\2.0\GEDD6PQW.N72\8M9ONPGG.TVB\prof..tion_40c30d08e677b188_0001.0000_985901e6c8ad767f\ReceiptTemplates\ReceiptTemplates\templates.xml

The templates.xml file has a Build Action of Content.

Note: There are other folders/files in the ReceiptTemplates folder that are present such as folder/item.html and picture.bmp, just not the templates.xml file that I can tell...

What am I missing?

Upvotes: 2

Views: 2157

Answers (1)

Brock Hensley
Brock Hensley

Reputation: 3645

Thanks to @drch for this:

In my case the ReceiptTemplates/templates.xml file was set to be a "Data File" and not "Include".

Solution:

Right click Project -> Properties -> Publish -> Application Files

Find file causing issue and change it to Include

If it says 'Data File' its in the data folder
If it says 'Include' its in the bin folder

Check in C:\Users\dirt\AppData\Local\Apps\2.0\Data for it ;)

Upvotes: 1

Related Questions