根据文档 https://docs.microsoft.com/en-us/nuget/schema/msbuild-targets ,看起来 msbuild 现在支持 NuGet 的 2 个特定目标: PackRestore
我已经能够正确使用 Restore ,但不能正确使用 Pack



它支持传统的 .Net 项目还是仅支持 .Net Core?
我一直找不到任何文件清楚地说明它。

关于所需的依赖项,我正在使用

PM> nuget help
NuGet Version: 4.1.0.2450
usage: NuGet <command> [args] [options]
Type 'NuGet help <command>' for help on a specific command.


C:\Git>msbuild /version
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.

15.1.1012.6693


Microsoft Visual Studio Professional 2017
Version 15.2 (26430.12) Release
VisualStudio.15.Release/15.2.0+26430.12
Microsoft .NET Framework
Version 4.6.01586

最佳答案

“基于 SDK”的项目支持开箱即用。 VS 中没有使用此“新型 csproj”的 .NET Framework 库的项目模板,但您可以创建一个 .NET Standard 库项目并手动将 csproj 文件中的 TargetFramework 属性从 netstandard1.6 更改为 net461 。请注意,用于这些类型项目的项目系统尚不支持经典 .net 项目中的许多可用功能(例如 WinForms、Xaml、edmx 的设计器)。

生成的项目文件如下所示:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net461</TargetFramework>
  </PropertyGroup>
</Project>

关于msbuild - msbuild/t :Pack supported in full . 是网络框架吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44547261/

10-14 11:52
查看更多