He-Man
He-Man

Reputation: 29

Package option missing when creating NuGet package

Im following this tutorial https://www.youtube.com/watch?v=-IXCTljXayg in an attempt to create a Nuget Package and deploy it to our Azure Devops under artifacts.

First step is to create the package but in the tutorial it says to right click the project (mine is a Class Library in C#, Visual Studio 2022 targeting .Net 4.7.2) > Properties but the Package option is missing??

I thought it was my VS instance so repaired it and same issue.

Do i need to install something?

Upvotes: 0

Views: 839

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100543

This system is only available for SDK-based (let's call it "modern") projects, not for legacy .NET Framework projects.

You can work around this by creating a .NET Standard or .NET (not Framework) project and replce the TargetFramework with net472 if you absolutely need to work with .NET 4.7.2. You will get the same tooling capabilities as a modern project but still use .NET Framwork.

The contents of your project's .csproj should look like this:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
  </PropertyGroup>

</Project>

Upvotes: 1

Related Questions