我有一个包含两种项目的整体解决方案:
对于在 4.8 上运行的项目,输出路径为“c:\product” 对于在 3.1 .net core 上运行的项目,输出路径为“c:\product\Remotepatching”,并且它具有 4.8 .net 框架项目之一的项目依赖性。
msbuild命令: “C:\Program Files (x86)\Microsoft Visual Studio�9\Professional\MSBuild\Current\Bin\msbuild.exe” “C:\Sources\APM.sln” /p:platform="x64" /p:configuration =“释放”
当我运行上述 cmd 来构建解决方案时,“c:\product”中的所有文件夹也会被复制到“c:\product\Remotepatching”。
但是如果我从 3.1 .net core 项目中删除项目依赖项,这些文件夹不会被复制。
msbuild 命令中是否缺少任何内容?
我猜测.Net Core 3.1是一个SDK风格的项目。 SDK 样式的项目支持复制传递依赖项。
将以下内容添加到您的 .Net Core 3.1 项目中以关闭此功能。
<PropertyGroup>
<DisableTransitiveProjectReferences>true</DisableTransitiveProjectReferences>
</PropertyGroup>
有关更多详细信息,请参阅 DisableTransitiveProjectReferences 文档和 ProjectReference 文档。