在我将Package添加到我的csproj后,我没有任何效果。接下来我将介绍再现步骤和我的项目文件夹内容。我的问题:我做错了什么方式,或者它是一个dotnet cli错误?我注册了一个issue,并将跟踪这两个问题 - 这个问题和问题。当我将NuGet.Core包添加到我的csproj作为PackageReference之后,我没有任何效果
重现步骤:
dotnet new console
- 变化
TargetFramework
在csproj
文件net461
dotnet add package NuGet.Core
- 添加
using NuGet
到Program.cs
(这个命名空间是存在于NuGet.Core大会,我已检查) dotnet restore
dotnet build
结果:错误 “的类型或命名空间名称的NuGet”找不到“。
我的项目目录的全部内容:
的NuGet-tree.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGet.Core" Version="2.14.0" />
</ItemGroup>
</Project>
的Program.cs:
using System;
using NuGet;
namespace nuget_tree
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
.NET CLI工具版本:我在两者上都试过:1.0.4
和2.0.0-preview2-25407-01
什么是你的csproj文件的名称? –
NugetTree.csproj – andrew