[英]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. 我有一个WPF项目,我准备使用Visual Studio 2012进行部署,但我遇到了丢失的文件夹问题。
If I Start the project in VS it runs fine and my test button works as expected. 如果我在VS中启动项目它运行正常,我的测试按钮按预期工作。
When I Publish the project, the publish succeeds, running setup.exe installs successfully and program starts to main window fine. 当我发布项目时,发布成功,运行setup.exe安装成功,程序启动到主窗口正常。
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_40c30d08e677b188_0001.0000_9a5540d4bfbe5aff\\ Reports'. "
“找不到路径的一部分'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_40c30d08e677b188_0001.0000_9a5540d4bfbe5aff\\Reports\\
确认不存在:
C:\\Users\\dirt\\AppData\\Local\\Apps\\2.0\\GEDD6PQW.N72\\8M9ONPGG.TVB\\prof..tion_40c30d08e677b188_0001.0000_9a5540d4bfbe5aff\\Reports\\
The Reports\\MyReport.rdlc files have a Build Action of Resource
and Copy to Output Directory of Copy always
. Reports \\ MyReport.rdlc文件
Copy always
具有Resource
的构建操作和复制到复制的输出目录。
What am I missing? 我错过了什么?
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). 在我的例子中,
Reports\\MyReport.rdlc
文件具有Resource
的构建操作,我所要做的就是将其更改为Content
(并确保Copy always
设置Copy always
)。
Solution: 解:
Right click File in Solution Explorer -> Properties -> Build Action -> Content 右键单击解决方案资源管理器中的文件 - >属性 - >构建操作 - >内容
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.