views:

51

answers:

2

Hi Guys, I have been trying for an hour or so and cannot get this right. I have a Visual Studio project which reads an Excel file, which I have added to the VS solution. When I run the project in VS, the file can be opened successfully. However, when I publish the project, the file does not get included, and therefore cannot be opened by the application.

I think there must be a way to say to Visual Studio to include that excel file to the deployment, however I can't find the option.

I am now to Windows Application development, so sorry for the trivial question!

A: 

I can think of 2 possible ways to do this:

1. Make sure the CopyToOutput directory attribute on the file is set to Copy Always or Copy if Newer.

-- OR --

2. Create a post-build step that copies the file manually to wherever you want.

Jay Mooney
+1  A: 

You have to tell Visual Studio the Excel file should be included with the release. Do this in the Properties window by changing "Build Action" to Content.

Or, you can do this in the project's Publish settings by right-clicking the project, selecting Properties > Publish > Application Files. Set the Publish Status to Include (Auto).

jons911