Deploy external file in c# solution with clickonce
I've a problem with Visual Studio Express 2010 c# edition. I've a project that reference a DLL. This DLL has an external Excel file marked as Build Action = Content Copy to Output Directory = Copy Always
When I build the solution, this Excel file is correctly copied into BINrelease solution folder.
BUT if I try to deploy the same solution, with Publish wizard, the Excel file is not copied in the install directory.
Please, could anyone help me?
Are you saying that the Excel file is referenced only by the dll you are including in your project? That is a secondary reference, and ClickOnce will not see it and automatically include the file.
First, on your dll, I'm assuming it is referenced directly by your project. If so, then be sure you have added it to your project and set the Build Action to "none" and "copy to output directory" to "do not copy". Then delete your reference to it and re-add it, pointing it to the version now included in your project. Set the "copy local" property to "true". This will ensure the dll itself gets deployed correctly.
For the Excel file, you are going to have to add it to your project. Set the build action to "content" and set "copy to output directory" as "copy always". It will not be included automatically because it is a secondary reference to the ClickOnce app, not a direct/primary reference like the dll is.
Open the Publish properties for your ClickOnce project. Then click on the 'Application Files ...' button. That launches a dialog where you can control which files are being included in the publishing package.
In order for your XLSX file (or any other non build file) to appear in that dialog you need to mark is as 'Content' in the Build Action of the properties window.
尝试将此文件包含到解决方案中,并将“复制到输出目录”设置为“始终复制”
链接地址: http://www.djcxy.com/p/65992.html