I am trying to install/restrore Microsoft.Net.Compilers.1.0.0
in VS 2017 using Nuget Package Manager. In the output it shows restore completed. however when i check the packages
folder i dont see Microsoft.Net.Compilers
folders.
And beacuse of that i get error
Severity Code Description Project File Line Suppression State Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ....\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props. XXXXX\Src\Api\Api.csproj 296
In csproj file there is a line at the top
<Import Project="..\..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" />
Background
This issue is occurring in Web API project with target framework 4.6.2.
I also have NET Standard 1.4
library that i want to share with different types of .NET application. When i add reference of NET Standard Library
to Web API project i got missing dependencies issues. So as per the suggestion i edited .csproj file and added
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
That fixed the missing dependencies issue.
Then i deleted package.config
file, removed all packages from packages
folder and added back all the packages (except i could not add Microsoft.Net.Compilers). The package reference is now in .csproj file
There SO post here, however in my case Microsoft.Net.Compilers
does not even getting restored to packages
folder. VS 2017 shows restored is complete but i don't know where its actually coping the files. (unless the folder name is different than Microsoft.Net.Compilers)
My original package.config file has this line
<package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net462" developmentDependency="true" />
now in .csproj file i have
<PackageReference Include="Microsoft.Net.Compilers">
<Version>1.0.0</Version>
</PackageReference>
UPDATE 1
So it looks like when packagereference is enabled nuget will install the packages at C:\Users\{username}\.nuget\packages
folder
that means i need to update csproj file with correct relative path.
What would be the relative path here for packages folder?