dotnet cli - After I add NuGet.Core package to my csproj as PackageReference, I have no any effect -
after add nuget.core
package csproj packagereference, have no effect. next describe reproduction steps , project folder content. question: doing wrong way or dotnet cli bug? registered issue , track both - question , issue.
steps reproduce:
dotnet new console
- change
targetframework
incsproj
filenet461
dotnet add package nuget.core
- add
using nuget
program.cs
(this namespace exists in nuget.core assembly, checked) dotnet restore
dotnet build
result: error "the type or namespace name 'nuget' not found".
full content of project dir:
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 tools version: i'm tried on both: 1.0.4
, 2.0.0-preview2-25407-01
i figured out problem not in dotnet cli, in nuget. following:
- created console application in visual studio 2015
- in package manager console:
pm> install-package microsoft.web.xdt -version 2.1.0
pm> install-package nuget.core -version 2.13.1
that worked fine. if installed latest version of nuget.core
in packages dir in nuget.core subfolder there no lib
folder assembly. , can't reference in project. seems weird. i decided clear nuget cache. , solves problem. after cache cleared can create new project , use latest nuget.core.
to clear cache used:
nuget locals -list
- list local cachesnuget locals -clear
- clear caches
Comments
Post a Comment