Typically, some files from the Web Application should not be overwritten when performing the deployment (e.g. web.config
). This can be accomplished by:
1) Excluding from output - which means setting Build action to None. This is the easiest way, but it might not work for some particular files or folders, that must be in the output for the application to run locally
2) Excluding Files and Folders from a Web Package by creating a special xml file in the Web application root folder. E.g.:
File name = [project name].wpp.targets
File content =
<Project ToolsVersion="4.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<!-- this will exclude all files from Internal folder -->
<ExcludeFromPackageFolders Include="Internal">
<FromTarget>ContactManager.Mvc.wpp.targets</FromTarget>
</ExcludeFromPackageFolders>
<!-- this will exclude specified files -->
<ExcludeFromPackageFiles Include="Scripts\jquery-1.4.4-
vsdoc.js;Scripts\jquery-1.4.4.js;Scripts\jquery-ui.js;Scripts\jquery.unobtrusive-ajax.js;Scripts\jquery.validate-vsdoc.js;Scripts\jquery.validate.js;Scripts\jquery.validate.unobtrusive.js;Scripts\MicrosoftAjax.debug.js;Scripts\MicrosoftMvcValidation.debug.js">
<FromTarget>ContactManager.Mvc.wpp.targets</FromTarget>
</ExcludeFromPackageFiles>
</ItemGroup>
</Project>
More details can be found here.