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:

  1. dotnet new console
  2. change targetframework in csproj file net461
  3. dotnet add package nuget.core
  4. add using nuget program.cs (this namespace exists in nuget.core assembly, checked)
  5. dotnet restore
  6. 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:

  1. created console application in visual studio 2015
  2. in package manager console: pm> install-package microsoft.web.xdt -version 2.1.0
  3. 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 caches
  • nuget locals -clear - clear caches

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -