简体   繁体   English

项目设置中缺少Visual Studio 2017包选项卡

[英]Visual Studio 2017 package tab is missing in project settings

I created a simple library .NET Framework project. 我创建了一个简单的.NET Framework项目库。

I would like to generate NuGet packages after build as described here . 我想生成所描述的建立后的NuGet包在这里

However, the Package tab is missing, here is a screenshot: 但是,缺少Package选项卡,这是一个截图:
截图

Visual Studio 2017 package tab is missing in project settings 项目设置中缺少Visual Studio 2017包选项卡

That because your project is library .NET Framework, which still using packages.config to manage NuGet packages. 这是因为您的项目是库.NET Framework,它仍然使用packages.config来管理NuGet包。 And Package tab is only supported by the new nuget package management form: PackageReference . 并且Package选项卡仅受新的nuget包管理表单支持: PackageReference

.NET Standard class library or .NET Core projects come with PackageReference enabled by default. .NET Standard类库或.NET Core项目默认启用PackageReference。 So you can create .NET Standard class library or .NET Core project , then you will see Package tab on the properties window. 因此, 您可以创建.NET标准类库或.NET Core项目 ,然后您将在属性窗口中看到“ Package选项卡。

If you want to use the Package tab for library .NET Framework project, you can convert your project from the old .csproj to new .csproj , (Right click your project->Unload project->Edit .csproj. Replace the contents of your csproj with the following: 如果要使用库.NET Framework项目的“包”选项卡,可以将项目从旧的.csproj转换为新的.csproj ,(右键单击项目 - >卸载项目 - >编辑.csproj。替换您的内容csproj具有以下内容:

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

See Old csproj to new csproj: Visual Studio 2017 upgrade guide for more info about convert old .csproj to new .csproj. 有关将旧的.csproj转换为新的.csproj的详细信息,请参阅旧的csproj到新的csproj:Visual Studio 2017升级指南

Note: Need to delete the AssemblyInfo.cs file in the Properties. 注意:需要删除属性中的AssemblyInfo.cs文件。

After convert to new .csproj, you will get the Package tab for library .NET Framework project: 转换为新的.csproj后,您将获得库.NET Framework项目的Package选项卡:

在此输入图像描述

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM