Anders
Anders

Reputation: 53

VS2010 "Copy to output directory" not working?

I'm trying to publish my web solution to the file system, using the "Only files needed to run this appllication" option.

I have the following problems:

a) I have a connectionStrings.config file that should be included; I've marked this file as Content and Copy Always.

b) For testing purposes, I've added a textfile.txt that should not be included; I've marked this as Content and Do Not Copy.

Both of these settings fail... It seems that the setting "Copy to output directory" is simply disregarded.

Any ideas why this happens, and what to do about it?

Upvotes: 5

Views: 12337

Answers (4)

David Castro
David Castro

Reputation: 1975

I re-started my visual studio and select the "copy always" option again. Rebuild and worked.

Good Luck.

Upvotes: 0

rswank
rswank

Reputation: 133

I just had this problem and for some reason choosing "Create application without a manifest" under the project's properties finally copied the linked content file to the build directory.

Upvotes: 0

CraigH
CraigH

Reputation: 21

I had the same problem, that files marked as content, with "copy always" set, were not appearing in the output dir.

At the time i noticed this, i was tracking down why certain of my dlls were not getting deployed.

Sorting my project dependencies fixed both issues.

Upvotes: 2

ChrisF
ChrisF

Reputation: 137158

The "Copy to output directory" is for when you are building your application, not publishing it.

This property specifies the conditions under which the selected source file will be copied to the output directory. Select Do not copy if the file is never to be copied to the output directory. Select Copy always if the file is always to be copied to the output directory. Select Copy if newer if the file is to be copied only when it is newer than an existing file of the same name in the output directory.

Source

There's more information on publishing web sites and applications here

Upvotes: 5

Related Questions