Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy external file in c# solution with clickonce

Tags:

c#

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 BIN\release 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?

like image 814
stexcec Avatar asked Oct 11 '11 16:10

stexcec


2 Answers

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.

like image 86
Philipp Schmid Avatar answered Oct 17 '22 21:10

Philipp Schmid


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.

like image 28
RobinDotNet Avatar answered Oct 17 '22 21:10

RobinDotNet