Search code examples
visual-studiotfsmsbuild-task

Avoid .CONFIG files in Build task TFS


there's any property that I could set in MSBuild Argument in order to avoid config files in Build task?


Solution

  • If my understanding is correct, you want to exclude .config file when you publish your web application.

    If this is the case, instead of MSBuild argument, you have two options here:

    1. In the .pubxml file, add an ExcludeFilesFromDeployment element in the PropertyGroup element. In this element, you can specify a single name, or you can specify multiple names delimited by semicolons (;), as shown in the following example:

      <PropertyGroup"> <ExcludeFilesFromDeployment> File1.aspx;File2.aspx </ExcludeFilesFromDeployment> </PropertyGroup>

    2. In project file, add an ExcludeFromPackageFiles element. For example let’s say that you have file named Sample.Debug.js which included in your web application but you want that file to be excluded from the created packages:

    <ItemGroup> <ExcludeFromPackageFiles Include="Sample.Debug.xml"> <FromTarget>Project</FromTarget> </ExcludeFromPackageFiles> </ItemGroup>

    Useful links:

    https://msdn.microsoft.com/en-us/library/ee942158(v=vs.110).aspx#can_i_exclude_specific_files_or_folders_from_deployment

    http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx