Deploying Content file from dependent assemblies with ClickOnce

白昼怎懂夜的黑 提交于 2019-12-19 06:22:06

问题


I have a simple WinForms app that I am deploying internally using ClickOnce. The main application has a dependent assembly, that assembly has some xml template files marked as "Content" and "Copy Always" in the build properties, however they do not show up in the list of Application Files if I go into the Project Properties->Publish->Application Files dialog.

Anyone know how I can deploy these Xml files that are part of a dependent assembly.

@codeConcussion- Thanks, that worked great. In the end I added the xml file using a Add Existing File and selected 'Add as Link', which accomplished the same thing.


回答1:


I'm using VS 2008 SP1, so I'm not sure this will work exactly the same for previous VS versions.

You can take care of your problem by simply adding a post-build event to your main project. In a VB.Net project that would be My Project > Compile Tab > Build Events... > Edit Post Build.... In C#, Project Properities > Build Events > Edit Post-build.... A simple xcopy [source file] [destination folder] command to copy the xml template file from the dependent assembly's bin folder to the main project's bin folder should work.

From there, just make sure you check "Show all files" in the Application Files dialog of the Publish tab.

An alternative to this would be to change your two projects to build to the same bin folder. That works great but I would only do it if the dependent assembly is specific to this application and isn't a library assembly used by multiple apps.



来源:https://stackoverflow.com/questions/423162/deploying-content-file-from-dependent-assemblies-with-clickonce

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!