Brock Hensley
Brock Hensley

Reputation: 3645

Visual Studio 2012 Deploying WPF via ClickOnce missing Folder and Files

I have a WPF project that I am ready to deploy using Visual Studio 2012 but I'm running into a missing folder issue.

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 the test button crashes the application.

Line that causes crash:
string[] reportFileNames = System.IO.Directory.GetFiles("Reports");

"Could not find a part of the path 'C:\Users\dirt\AppData\Local\Apps\2.0\GEDD6PQW.N72\8M9ONPGG.TVB\prof..tion_40c30‌​d08e677b188_0001.0000_9a5540d4bfbe5aff\ Reports'."

Confirmed Exists:
C:\MyProject\bin\MyMode\Reports\
C:\MyProject\bin\MyMode\Reports\MyReport.rdlc

Confirmed Does Not Exist: C:\Users\dirt\AppData\Local\Apps\2.0\GEDD6PQW.N72\8M9ONPGG.TVB\prof..tion_40c30‌​d08e677b188_0001.0000_9a5540d4bfbe5aff\Reports\

The Reports\MyReport.rdlc files have a Build Action of Resource and Copy to Output Directory of Copy always.

What am I missing?

Upvotes: 0

Views: 1131

Answers (1)

Brock Hensley
Brock Hensley

Reputation: 3645

Ok, was able to figure this one out rather quickly after typing that last sentence in the question...

In my case the Reports\MyReport.rdlc file had a build action of Resource and all I had to do was change it to Content (and make sure Copy always is set).

Solution:

Right click File in Solution Explorer -> Properties -> Build Action -> Content

Upvotes: 2

Related Questions