Reputation: 1185
Based on documentation https://learn.microsoft.com/en-us/nuget/schema/msbuild-targets, it looks like msbuild now support 2 specific targets for NuGet: Pack
and Restore
.
I have been able to use Restore
properly, but not Pack
.
error MSB4057: The target "Pack" does not exist in the project.
Is it supported for traditional .Net project or is it a .Net Core thing only?
I haven't been able to find any documentation stating it clearly.
Regarding required dependencies, I am using
PM> nuget help
NuGet Version: 4.1.0.2450
usage: NuGet <command> [args] [options]
Type 'NuGet help <command>' for help on a specific command.
And
C:\Git>msbuild /version
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.
15.1.1012.6693
With
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
Upvotes: 4
Views: 3093
Reputation: 100751
It is supported out of the box for "SDK-based" projects. There is no project template in VS for .NET Framework libraries using this ""new-style csproj"", but you can create a .NET Standard library project and manually change the TargetFramework
property in the csproj file from netstandard1.6
to net461
. Note that the project system that is used for these types of project doesn't support many features available in classic .net projects yet (like designers for WinForms, Xaml, edmx).
The resulting project file would look like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
</Project>
Upvotes: 5
Reputation: 1185
Looks like I did not Google enough... this blog post clearly speaks about .Net Core only: http://blog.nuget.org/20170316/NuGet-now-fully-integrated-into-MSBuild.html
Some of the features discussed earlier are not yet fully supported for packages.config based projects such as defining nuspec metadata in project files, building packages directly from a project, [...]. We are hard at work to bring full PackageReference support to these project types. Our goal is to eventually make PackageReference the default and move away from all other formats.
Upvotes: 1