What’s the difference between Content and None when “Always copy to output directory” is set?

Not everything which is copied to your output directory, by setting CopyToOutputDirectory, is copied to the Content Output Group. Therefore, you may do this:

File1---CopyToOutputDirectory = Copy always, Content 
File2---CopyToOutputDirectory = Copy always, Content 
File3---CopyToOutputDirectory = Copy always, None

All three files will be copied to output directory but only File1 and File2 will be copied to Content Output Group.

Furthermore, Content allows you to retrieve a file (in same directory as the assembly) as a stream via Application.GetContentStream(URI). For this method to work, it needs a AssemblyAssociatedContentFile custom attribute which Visual Studio graciously adds when you mark a file as Content.

None and Content are values for How the file relates to the build and deployment process. Therefore, your build (MS Build for example) and deployment may be very different than simply taking files from the output directory. You may have a .bat file that you do not really need in the output directory but you need it for deployment.

This SO answer has more details about the different build actions.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)