SuperJMN
SuperJMN

Reputation: 13972

Creating NuGet package from .NET Framework 4.7.2 project

I have created NuGet packages for .NET Standard class libraries, that is really easy with dotnet.exe. But it seems that dotnet pack doesn't work for plain old .csproj files targeting the full .NET Framework.

What is the preferred method to generate packages out of these kind of projects? With dotnet.exe? with nuget.exe? with msbuild?

I'm lost. It looks like package creation is a craft more like an automatic process! It's so confusing.

Upvotes: 2

Views: 4146

Answers (2)

user23298442
user23298442

Reputation: 1

This worked for me (in Powershell):

cd "pathToProject"
& "C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe" -t:pack -p:"PackageOutputPath=myPackage;Authors=Me"

If you get weird build errors run "C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe" /t:restore first

I have this from here

Upvotes: 0

ana
ana

Reputation: 1111

The preferred method to generate packages out of .Net Framework projects depends at least if the project is SDK-Style, or not.

Here we can find more details: https://learn.microsoft.com/en-us/nuget/resources/check-project-format

Upvotes: 3

Related Questions