开发者

Prevent "superflous" files being copied into my Release directory

I'm using VS2008 to compile my C# Console App. When I release my app, I have to delete lots of what appear to me to be superfluous files. For example,

开发者_开发知识库
MyApp.vshost.exe.manifest
MyApp.vshost.exe.config
MyApp.vshost.exe
MyApp.pdb

How do I prevent these files being copied into my Release directory? Oh, I'm using Reshaper also - if that makes any difference.


To remove the PDB file, just turn off PDB generation in the project settings. (Go to the Build tab, Advanced, and set "debug info" to "none" - if you're really sure you don't want the debug info...)

The VSHOST files are to allow Visual Studio to host the executable in a reusable process - basically this is a way of restarting the app quickly within Visual Studio. To stop them from being produced, again go into the project properties, this time in the "Debug" tab, untick "Enable the Visual Studio Hosting Process" option.


I suggest not to remove those files from your Release directory. Instead, create a separate folder (let's call it Deploy) for the files you really want to deploy, and make a script fillDeploy.bat which copies exactly the needed files from Release to Deploy. This script can do some additional things for your deployment (for example, put the documentation files there, provide a different config file etc). If you want this script to be called every time you make a Release build, add a postbuild event to your project like this one:

if $(ConfigurationName)==Release call $(ProjectDir)fillDeploy.bat


Inside the Properties of the project you are building you can configure these things. The exact place of the options varies from version to version of Visual Studio. Start in the "Build" tab and then look in the "Advanced" area.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜