How to create a Nuget package with Visual Studio 2017

I am creating a .net 4.5 class library DLL with Visual Studio 2017.

I want to pack this DLL and some related folders of javascript, html, css and similar files as a package NuGet.

Unfortunately, I don't know where to start - the only instructions I can find for creating packages NuGetare Visual Studio 2015. I was told that it is NuGetincluded in Visual Studio 2017, but if I open Developer Command Prompt for VS 2017and type NuGet, the command will not be found.

It seems that he Visual Studio 2017can create packages NuGetin standard standard .Net projects, but not in other types of projects.

Should I go back to Visual Studio 2015, or what?

+4
source share
1 answer

There are several different questions here:

About VS Integration: In VS <2017, NuGet was usually an extension that could be updated individually. In VS 2017, the extension is tightly integrated and updated through updates of VS itself. This never included the command line nuget.exe, which is usually used for packaging and push packages - this command line client is available from the NuGet download page .

The "classic" approaches to packaging .NET projects still work and are documented in the nuget documentation page , the section Creating a .nuspec ... file from a Visual Studio project is especially important .

VS 2017 , ".NET Sdk", .NET Core. NuGet VS MSBuild/ dotnet pack. .NET Framework NuGet. VS , , .NET, (, Designers for xaml, edmx). .NET Standard csproj

<TargetFramework>netstandard1.6</TargetFramework>

<TargetFramework>net461</TargetFramework>

.NET 4.6.1 ( ). , .NET Standard .NET Core. " Standard Visual Studio 2017" , .

, :

<ItemGroup>
  <Content Include="**\*.txt" Pack="true" />
</ItemGroup>

content contentFiles nuget. ProjectReference, ContentFile , , :

<ItemGroup>
  <Content Include="**\*.txt" Pack="true" PackageCopyToOutput="true" />
</ItemGroup>

VS 2017 15.3/.NET Core SDK 1.1/2.0 ( ).

+6

Source: https://habr.com/ru/post/1679730/


All Articles