there's any property that I could set in MSBuild Argument in order to avoid config files in Build task?
-
Could you elaborate what's the meaning of avoid config files in Build task? – Cece Dong - MSFT Feb 06 '18 at 07:37
-
ok sorry , i mean , how no to publish .Config files – Juan Ruiz Feb 06 '18 at 19:35
1 Answers
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:
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>
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:

- 29,631
- 1
- 24
- 39
-
Thanks @Cece Dong , that worked for me, also form TFS you could add a task in after MSBuild, "Delete files" task , and when i build from Visual Studio your answer is just perfect . – Juan Ruiz Feb 07 '18 at 15:44