I have Asp.netCore
solution which was working fine on Visual Studio 2015
and then i moved to Visual Studio 2017
. Now the problem is that in Visual Studio 2017
on every nuget packages there is yellow exclamation mark. Following are solution which i have tried so far.
I'm using Visual Studio Version: 15.3.1
Clear All Nugget Cache(s)
from Tools > options > NuGet Package Manager >
and again restore Nuget.Note: I have searched and found following solution and tried but did not resolve my issue.
I found the answer on another thread here and credit should go to @AxelWass although he did not specifically focus it towards this, it absolutely fixes this issue. The above answer did not.
I had the same issue and solve it by opening the project in a text editor and deleting the following section:
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>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 {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
</Target>
Once this is removed, it will resolve this nightmare issue that VS2017 and PM seems to be unable to resolve. I too have run into this multiple times - especially when I blend many projects in the same solutions directory.
As mentioned in Microsoft Installing and reinstalling packages with package restore Documentation , you should Update-Package -reinstall
:
Update-Package -reinstall -ProjectName <project>
command where is the name of the affected project as it appears in Solution Explorer. UseUpdate-Package -reinstall
by itself to restore all packages in the solution.
If you still have the error, try edit your project file, check if there is A path refrence error there, also check the project/solution nuget config file.
By default, new installation of visual studio did not configure package source to search packages online. That caused the problem.
I found the answer with a little bit more work from a stackoverflow link: https://stackoverflow.com/a/32360953/1503372 .
That answer mentions to use " https://www.nuget.org/api/v2 " url to restore packages. When I opened the package manager console in visual studio 2017, I found it was searching for packages from my PC only (offline search).
I then added " https://www.nuget.org/api/v2 " url as a source for restoring packages and it worked.
Follow below steps to add a package source.
Once you have configured your visual studio to search for packages online, your all packages will be restored.
I discovered a wrong configuration in the nuget.config
. I don't know why, in this file there are some exclusion for my current project.
You can see your global configuration running this command in File Explorer
%AppData%\\NuGet\\NuGet.Config
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.