I am getting the following issue while compiling my project. It is a MVC 5 application. Here is the 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. WikidoctorAdmin E:\My Projects\Wiki-Doctor\Wiki-Doctor.com\Wiki-Doctor.com\WikidoctorAdmin\WikidoctorAdmin.csproj 2107
Please help me how to solve this error.
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>
I didn't need Nuget for this project.
Hope this helps.
You can fix this one of two ways:
Under Tools/Nuget Package Manager:
Menu screen capture
1) Choose the first option (Package manager Console).
Package manager console window will appear (Usually toward the bottom of the screen)
You should see a button that says "Restore Missing packages"...Click it.
This method will work for this project only...and you will have you redo this for each project with missing packages
2) Choose Package Manager settings
Make sure the check box that says "Allow Nuget to download missing
packages" is checked
Re-build your solution
Nuget will automatically download missing packages from now on. This is easier, but might not always be what you want.
The name of the project is longer than 248 characters. You need to rename the path under 248 characters, then open solution and rebuild and the nuget will be updated.
that worked for me having similar error -
go to your complaining project references - find references with yellow marks
open solution nuget package manager and 'reinstall' nuget packages which have those yellow marked dlls.
easy way to reinstall one by one - select nuget in the right, in the left upper portion there would be checked projects.
in the left lower portion - select one version down, install, select one version up (your needed version), install - repeat for all questioned nugets
I've got the same problem, and I solved this way:
- erase every obj and bin folders under the solution projects,
- using the NuGet Package manager to restore and update all packages.
Hope it helps.
Related
This is a simple error, but frustrating? My project won't rebuild/compile. The error is:
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.2.1\build\Microsoft.Net.Compilers.props. Microsoft.Bot.Sample.LuisBot C:\Users\jmatson\Downloads\retail-info-bot-src\Microsoft.Bot.Sample.LuisBot.csproj 229
So I try a nuget restore and get:
All packages are already installed and there is nothing to restore. Time Elapsed: 00:00:00.0455939
========== Finished ==========
So who is right, who is wrong, and how is this fixed? :/
Visual Studio compile error - nuget package missing from computer, but nuget restore says all packages installed?
First, make sure you are not add the \packages folder into the source control. If you added it, remove it from source control.
Second, if you are not using source control or not add that folder into the source control, but still have this issue, you should delete the package Microsoft.Net.Compilers.1.2.1 in the \packages folder, then use the NuGet command line in the Package Manager Console:
Update-Package -reinstall
to force reinstall the package references into project.
The file Microsoft.Net.Compilers.props location change or the file missing in the packages folder will cause this issue. In other words, the file Microsoft.Net.Compilers.props is missing the packages folder but the package is there, you will get the that error.
Check the similar issue here.
Hope this helps.
When trying to install the NuGet Package RestSharp I get the error The path is not of a legal form and the package is not installed.
When installing from the console using Install-Package RestSharp, there are a lot of the following messages:
The item
C:\Users\myName\Source\Workspaces\Project\Solution\packages\RestSharp.105.1.0\lib\net35\RestSharp.dll
could not be found in your workspace, or you do not have permission to
access it.
This happens with the newly released Visual Studio 2015 (community edition).
Edit: If you have NuGet 3.0, then that's the problem. Just update NuGet and everything should work. The steps below apply to NuGet 3.0, which are painful and error prone. Don't go through such pain, choose the easy step, update your Nuget!
I updated to VS Express 2015 and since then i've been through some adventures.
TL;DR if you "disable" TFS (source control), you should be able to install the package. Then add the solution to source control again, but it caused me tons of problems.
So...
I see you have TFS. I have it too.
Also, I see you are getting the same error messages as me.
I tried to install LanguageExt (an awesome library for C# 6) and it failed when it tried to install one of its dependencies (System.Collections.Immutable).
If you want to go through all this things, please make a backup of your project folder.
This is what I did:
1 - Copied my solution folder to somewhere else.
2 - Opened the solution. VS smartly asked me to add it to source control, but I didn't want to.
3 - Tried to Install-Package LanguageExt
4 - Unexpected success!
5 - "Fine, let me just add it to the TFS source control again"
Here my journey started.
Since I have little experience with TFS, I got thousands and thousands of conflicts, files vanishing and appearing again, etc.
But after some work, I got it running.
And it was worth it.
But the solution isn't large, so, it was easy.
Had the same problem with the packages below, updated NuGet via "Tools -> Extensions and Updates -> Updates" to v.3.1.1.0 and now everything works again. Thanks!
Microsoft.Bcl
Google.Apis.Calendar.v3
RazorEngine
Sample error so more people can find this thread:
"Install-Package : The path is not of a legal form.
At line:1 char:16
+ Install-Package <<<< RazorEngine
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand"
Had a same problem with my VS 2015, I just added the reference via nuget by opening the same solution in VS 2013 and then reopened it back in VS 2015 for usual work.
I had this happen on version 3.5.0.1484 of the nuget package manager. In my case a merge from a dev branch altered a packages.config file to list a version of a package that was no longer present. Any attempt to use one of the package commands in the Package Manager Console after loading the solution failed with the The Path is not of a legal form. error. I ended up using the solution level gui to consolidate on the affected packages and that resolved the error. Likely I could have just reverted the packages.config file as well.
Please add an entry in package.config manully as given below and build the solution. This works for me.
I had the same issue in VS 2017, with another package (WPFLocalizeExtension).
The way to solve that was to delete .nuget folder from the project, then go to .csproj project file, and delete the following lines:
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable 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('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
After that (and after trying all the existing solutions into the whole world), I rebuilded the project nad the program runs succesful and works perfect.
It's really incredible the bugs of nugget repository....you need some kind of magic to solve in each specific case, it's terrible.
Hope this solution helps anyone.
I have a solution/team project set up in visual studio 2013 and for some time have had a working NuGet Microsoft.Bcl Async Package installed for NET Framework 4.0. Today when opening the project all of the default .NET system library references cannot be found, They just have a warning symbol next to them. I have 49 warnings when building the project all saying 'The referenced component 'System.X' could not be found. Or 'The referenced component 'Microsoft.X' could not be found. Yet references to other projects in the solution remain intact.
If it is of any significance I have been using the built in version control system to keep backups of my code and access it from my other pc with the same configuration.
Looking at the other questions on stackoverflow with similar issues people seem to point towards NuGet as potentially causing the problem but without any solution that seems to work for me. I have tried the obvious solution of removing and re-adding the reference using both the file browser and the Framework tab but neither has worked so far.
I cannot currently compile the project as I get this warning, undoubtedly caused by the missing references in the first place.
Error 31 The "EnsureBindingRedirects" task could not be loaded from the assembly C:\Users...\Visual Studio 2013\Projects\AlgorithmToolsTFVC\AlgorithmToolsSuite\AlgorithmTools\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.Tasks.dll. Could not load file or assembly 'file:///C:\Users...\Visual Studio 2013\Projects\AlgorithmToolsTFVC\AlgorithmToolsSuite\AlgorithmTools\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.Tasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. AlgorithmTools
A possible solution: If you are seeing yellow triangles over most of your System references, edit your .csproj file (back it up just in case), scroll to the bottom of the file, and delete these lines...
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable 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('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
Like many others, I've been using a centralized .packages folder outside of source control. This is done by having the following lines in your NuGet.Config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="..\..\..\.packages" />
</config>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
One of the steps in achieving this, is to check your project file does not use the old NuGet.targets file anymore (the only file in your .nuget solution folder should be NuGet.Config).
When NuGet thinks it should check the NuGet.targets file, and it's not there, it will fail checks to basic references too (like System.Core, WindowsBase and PresentationCore).
Update: See this related topic/answer on how to completely do away with .nuget folders in your solution! It can be set at user-profile level in your AppData.
I was able to solve this issue by first running an update on all NuGet packages in the solution and then removing and re adding references to the libraries included or overridden by the package.
Just had the same problem.
The reason for me was that all the files inside the Nuget package, suddenly become 0 byte size. I mean DLLs, nupkg file etc.
I reinstalled the package and it worked for me.
I had exactly the same problem with my project on team foundation server. I had the error saying "EnsureBindingRedirects" task could not be loaded from the assembly C:\Users...\Visual Studio..." and many warnings saying "The referenced component 'Microsoft.X"
The solution was very easy. All I had to do was copy my entire project folder into another location and it worked.
Had a similar problem. After wasting 2.5 hours trying to find a solution, I fixed it simply by opening the project in VS 2013, enabling NuGet package restore and rebuilding. Fixed immediately and now it works in VS 2015 just fine.
Just had the same issue and solved it by executing the following command in package manager console:
Update-Package -Reinstall
If you want to do this for a specific project you can use:
Update-Package -ProjectName 'ProjectNameGoesHere' -Reinstall
I am trying to restore the missing nuget packages and it keeps giving me this Error:
An error occurred while trying to restore packages. Please try again.
Any experience solving this?
How can I find out what exactly is causing the error?
This is how I fix my issue:
First, I clear my Package Cache:
Second, I make sure I have the right path source and click the available package source:
Make sure you upgrade to the latest NuGet (http://docs.nuget.org/docs/start-here/installing-nuget).
Make sure you're doing package restore "The Right Way" http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html
That should resolve the issue.
If you don't want the package, just double-click your packages.config, find the line which refers to the package you want to get rid of, and delete that line.
Then, if you do want the package you could probably just redownload it using nuget and it'd probably resolve itself.
I had a similar issue with the Microsoft.Bcl.Build.1.0.14 NuGet package. My solution to this was to
Close Visual Studio
Remove the package folder with Explorer (or better only move it to another location)
Start Visual Studio
Go to the NuGet package manager and click Restore
I resolved the same issue by downloading the latest version of NuGet (really easy install, quick download): http://docs.nuget.org/docs/start-here/installing-nuget
(Definitely a beginner's answer here, but I'll leave it since I didn't find this anywhere else.) Make sure that nuget.org hasn't been unchecked from your package sources.
Tools. Options. Nuget package manager. Package sources. Ensure "nuget.org" is checked.
The problem in my case
In my case, we have developed our own NuGet packages. For some indescribable reason when I opened the solution, When I open solution, that has a previous version of NuGet packages that is deleted from origin or removed or unreachable for any reason. This make it unable to build the projects containing specific NuGet packages. I tried to install/reinstall/upgrade the NuGet package with out luck getting following error (see the image below), I did also try all possible answers here, and ensured the package was there, but no luck.
An error occurred while trying to restore packages: Unable to find version xxx..etc.
The solution for my case
Close your solution and find the path of the solution
Open all your projects .csproj files with notepad editor, that contain the packages that have the issue and remove all references that is shown in the error message, looks like this and save:
<Reference Include="Xxx, Version=30.0.0.16927, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xxx.35.1.122605\lib\net461\Xxx.dll</HintPath>
</Reference>
In each folder where your .csproj is located, you find packages.config file, open it with notepad editor and remove all packages that is shown in the error message, looks like this and save:
<package id="Xxx" version="35.1.122605" targetFramework="net461" />
Start your solution, the error now should disappear, but you can not build because we have removed references and packages. So now you should be able to install your missing packages in fresh. When done build and all should work. Enjoy :)
I had similar issue, i found out it was due to my nuget cache.
Command to clear cache: dotnet nuget locals all --clear
After cache is cleared try restoring.
i fix this problem by moving the project folder to another one with less characters (local path was to long) i hope it helps some one
For me I cloned a solution (vs2015/NuGet3.4) that had a nuget dependency on a pre-release package that had been superceded. Nuget failed to restore the pre-release and wouldn't let me either uninstall or upgrade it. I frigged it by manually editting packages.config to target an older non-pre-release of the package, which I could then upgrade to the version I wanted. HTH
Just in case it helps someone else, I had this issue in a .NET Standard project where I had defined the target frameworks incorrectly:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.3;netstandard2.0;net45</TargetFramework>
</PropertyGroup>
...
When it should have been the plural TargetFrameworks (not TargetFramework):
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard1.3;netstandard2.0;net45</TargetFrameworks>
</PropertyGroup>
...
For me non of those things mentioned above work.
I solved this issue by deleting packages.config in each project of my solution and then reinstalling all Nuget packages
In my case, I had another package source added which was like this.
I just removed this source from the NuGet package manager and rebuild the solution, it started working for me.
Go to TOOLS under OPTIONS select NuGet Package Manager
General, Select Everything
Package Source, Select all required Source
Hit OK. Done you must be good to go.
So im downloading a project at home from work over team foundation server. I download the project and it won't compile because of the error. Warning 2 The referenced component 'EntityFramework' could not be found. Could anyone offer guidance in how I can get entity framework to work. I installed nuget package.
Thankyou
I suggest you to check:
1) "Allow NuGet to download missing packages during build" ticked
Tool --> Options... --> Package Manager --> General
2) "Project selected" ticked
Solution Explorer --> right-click on the solution/project --> Manage NuPackages
3) Rebuild Solution
EDIT
For completeness I would like to add that if you are working with a CI system (e.g. Jenkins) or you are using MSBuild on the command line, you need to select Enable NuGet Package Restore to make it work:
Enable NuGet Package Restore http://docs.nuget.org/docs/Workflows/images/enable-package-restore.png
I had the same problem. I solved it like this:
Choose References > Right-click > Add Reference ...
Choose Browse tab
Find your Project Folder > packages > EntityFramework.4.1.10331.0 > lib
Choose EntityFramework.dll
Click OK
This happened to me, after I moved projects to a subfolder.
Then, the relative paths to the packages folder were not correct anymore.
Got errors like that:
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\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets. PROJECTNAME D:\VSTS\TEAMPROJECT\src\PROJECTFOLDER\PROJECTNAME.csproj
Fixed it by editing the *.csproj file and corrected the relative paths, in my case from ..\packages to ..\..\packages
Also make sure to check the paths under
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
There are good ways suggested by the developers, you may also try this solution to solve your problem.
In your case your project has a reference to the EntityFramework library, but library it self is not available to you project. You may try either the following:
If you have NuGet package manager:
Click on Project-> Manage NuGet Packages. It will open following window.
Find the EntityFramework and click Install.
- Alternatively, Download the EntityFramework library to your computer, then
Right-Click the Prject-> Add References...-> Browse-> Locate your
EntityFramework library-> Click OK
- Optionally you may use package manager to install library reference, check this link package-manager-console (Note: This might require NuGet Package manager)
I solved this issue by adding Entity Framework reference (Add ref) under C:\ Prog Files\Entity...\Binaries\Entity Framework.dll into my project. Hope this helps!
An old thread, but for anyone that this may help..
What worked for me was to go to the 'Packages' folder in the root of my solution and delete the EntityFramework.6.4.4 folder.
Then, go to Manage Nuget Packages menu option, and this banner pops up:
After pressing Restore the missing reference was restored.