【发布时间】:2021-11-24 06:23:24
【问题描述】:
我在解决方案中有一些 .NET 项目。 当我发布它们时,我只想发布我的 src 项目的 DLL,而不是 test 的。
https://github.com/dotnet/docs/issues/13365 和 https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish#msbuild 都提到 IsPublishable 可以用来这样做。
.NET 5 项目似乎忽略了 IsPublishable。
我在任何测试项目中设置以下
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(ApplicationTargetFramework)</TargetFramework>
<IsPublishable>false</IsPublishable>
<IsPackable>false</IsPackable>
</PropertyGroup>
</Project>
但后来,当我执行dotnet publish -c Release -o publish 时,我仍然可以看到测试项目*.dll 和deps.json。为什么?如何实现我想要的?
【问题讨论】:
标签: .net msbuild .net-5 dotnet-sdk dotnet-publish