Search code examples
visual-studiomsbuild-15

Msbuild 15 includes config files not set as "do not copy"


We are wanting to start using MSbuild 15 instead of MSBuild 14. We have a small problem though.

Previously in MSBuild 14, when a file was marked in Visual Studio as "Do not copy" in the "Copy to Output Directory" setting on the file properties, then it didn't create a .dll.config file. But now using MSBuild 15, it does create a .dll.config file.

Is there a way in MSBuild 15 to not copy the file? As it creates backward compatibility problems.

Visual Studio Config File

Config File Setting


Solution

  • I was able to figure it out. You need to add /p:AllowedReferenceRelatedFileExtensions=none as a command line parameter for MSBuild 15 builds. It's not needed for MSBuild 14 builds.

    MSBuild Github Issue