Pages - Menu

How to exclude files and folders in .Net for deployment

Scope

We want to exclude some files or folders when we deploy / publish a project. They are mostly development only or internal folders that is not needed in productions.

Code

  1. Create a new XML file in the project folder (the same folder that holds the .csproj or .vbproj file) and name it <projectname>.wpp.targets.
  2. Use the following as the base, and modify to include what folders / files to exclude.
<?xml version="1.0" encoding="utf-8" ?>
<project toolsversion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <itemgroup>
    <excludefrompackagefolders include="[semi-colon-separated-folder-list]">
    </excludefrompackagefolders>
    <excludefrompackagefiles include="[semi-colon-separated-files-list]">
    </excludefrompackagefiles>
  </itemgroup>
</project>

Further Reading

No comments:

Post a Comment