I am trying to follow this article. There is a step which says you need to install XSockets.Sample.WebRTC via package manager console(PMC), this is where I got stuck. I have been getting an error which says File contains corrupted data, shown as below -
I went through this post
but none of the solutions worked for me. I could not find any solution to my problem. What am I doing wrong? How do I make it work?
Another question is, in the article that I am following, there is this picture which shows -
but I got nothing like LocalNuget in my package source. I got only two options - check the above image.
Why is this difference? Is there anything wrong with my visual studio installation?
The problem was with Nuget Package Manager Console.If anyone comes across this problem, then try and update the Nuget Package Manager version, worked in my case.
To update Nuget Package Manager click on
Tools -> Extensions and Updates -> Updates -> Visual Studio Gallery -> Nuget Package Manager.
I updated Nuget Package Manager version to 2.8 (latest till date) but same issues.
Finally, referring to solutions at http://nuget.codeplex.com/discussions/272453 I got the problem resolved.
By clearing package cache and disabling antivirus temporarily installation of XSockets.Sample.WebRTC via package manager console(PMC) was successful for me.
Try this:
Right click in the project -> Unload project
Then, right click in the .csproj and edit. Look for Xsockets.Sample.WebRTC (maybe is not there)
If it is there, remove it, and reinstall again after Load again the project ;)
I had a similar issue after using powershell to do a solution wide string replace. I wasn't careful to exclude .exe files from the command, and it altered the nuget.exe file in the .nuget folder. Upgrading Nuget Package Manager did not help, but replacing the nuget.exe with a version from another solution did.
An easy way to tell if this is your issue, is to run the suspect nuget.exe with a right-click, run as administrator and if it gives you an error that it's not compatible with your version of windows, than you know its busted.
i had the same error after recovering a solution the was deleted by mistake, solved the problem as following.
I closed visual studio then removed all packages from packages folder, when i opened the solution again the error message isn't there and VS asked me to restore missing packages, after restoring packages every thing is working fine :)
I recently got this out of the blue.
I needed to update to Package Manager console Version 2.8.60723.765.
Starting it displayed:
========================
NuGet Enable Package Restore Fix
========================
To fix package restore:
1. Please enable package restore in Visual Studio FIRST.
2. Run the command: Install-NuGetEnablePackageRestoreFix
3. Restart Visual Studio.
This should fix that pesky broken build you are experiencing.
Running
Install-NuGetEnablePackageRestoreFix
and Rebuilding fixed it for me.
During a package restore, my PC lost power. I also had the issue with nuget package manager:
File contains corrupted data
When I opened the Package Manager Console, I got this message:
Unable to read package from path 'Microsoft.OData.Core.6.15.0\Microsoft.OData.Core.6.15.0.nupkg'.
I solved it by simply deleting that package from the disk and when I opened package manager, the original error message was gone and I was able to restore the package I had deleted.
In my case, the Nuget Package Manager extension was already the latest version & also clearing up local cache didn't help either.
However, when I cleared the packages folder & rebuilt the solution - it fixed the problem.
Related
I created my first C# application recently, and since buying a new computer I cannot get the application to start.
I am receiving 7 of the following errors Error NU1101 Unable to find package Microsoft.VisualStudio.Web.CodeGeneration.Design. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages clesson C:\Users\porkh\Desktop\WERK\Personal\c-lesson\clesson\clesson\clesson.csproj
Each with different packages missing.
Since this was a missing dependencies message I reinstalled visual studio 2019 with C# .net support again, yet I am running into the same error.
On StackOverFlow I read that I need to check my NuGet packages,
Here it shows every package that is "missing" in the error messages as installed.
I have also tried running dotnet run and dotnet restore but I get the same error messages.
I am extremely new to C# so sorry if I have missed the solution in other's answers. Any help you can give me I'd appreciate it.
A link to all of my project files here
In the image it says
Not available in this source
and the package source is set to Offline Packages. My best guess is, switching to an official NuGet Feed in the drop down to the upper right, will solve your problem. You also want to check, if the Nuget source is available (it should).
If not, click the Cog icon, and add it there with the name "Nuget" and the Url https://api.nuget.org/v3/index.json
when restoring a locally created nuget package I receive the following error:
Failed to add reference to 'Microsoft.Data.SqlClient.SNI.x64'.
Please make sure that the file is accessible, and that it is a valid assembly or COM component
When I look at the nuget build I see the following
click to enlarge
The highlighted yellow "missing" dlls in the screenshot above do actually exist in the project.
I am using Visual Studio 2017 professional
Thanks for any help
Mark
Nuget package update - Microsoft.Data.SqlClient.SNI.x64
Please try the following steps:
1) close VS Instance, delete nuget.config file under C:\Users\xxx(current use account)\AppData\Roaming\NuGet.
2) delete .vs hidden folder under your solution folder, bin and obj folder then restart your project to test again.
3) Please try to create a new empty project in VS2019 and test whether you can install the package Microsoft.Data.SqlClient.
If you cannot install it, you should note that whether your VS or OS has broken. If the new project has no error, the issue is your project itself. You can try the above steps to troubleshoot the issue.
If the issue still persists in the new project,
You can try to repair VS or update VS to the latest version.
Also, try to update OS or use the System File Checker tool to repair missing or corrupted system files.
Besides, try another PC to test whether the issue persists.
Microsoft.Data.SqlClient.SNI.X64 or X32 files need to be removed from release folder before creating package.
Microsoft.Data.SqlClient.SNI.X64 will be added automatically while adding Microsoft.Data.SqlClient.
So, remove the dll before creating the package and then try installing it.
I've been working on a project with a coworker and we're using Visual Studio 2017 as IDE and also Git to push the versions to VS repository. We had a few problems and decided to start a new project in Visual Studio with the content we already had.
The weird thing is: when cloned the repository to my computer and synched, some of the references were lost. A yellow triangle appears next to the lost references icons in Solution Explorer, and it doesn't have a path set like the ones that work. Also, inside Source > Repos, the project folder has all files, including the ones that are missing. I tried deleting the project and cloning it again, tried to download only the .zip file and starting the project offline, and also running VS 2017 as administrator (it appears this solved similar problems for others before) and nothing worked. My coworker (who pushed the project to the repo in first place) can compile normally and is not facing this reference problem.
Has anyone ever experienced this issue?
We're using VSTS with a git repository, and this happens all the time, especially when pulling updated solutions. I find a clean and rebuild fixes the problem.
You can run in the Package Manager Console the following command to clean up the nugget packages:
Update-Package -reinstall -ProjectName XYZProjectName
or run it for the whole solution:
Update-Package -reinstall
In my case after a merge with the master branch, I had conflicts in the project file (.csproj). When resolving the issue VS2019 automatically had unloaded the project file where those conflicts were and I didn't notice. A check for that might save time for someone.
I once experienced it when I was having a Visual Studio 2015 project open and then pulling new git commits. The new project I was pulling was was set up for Visual Studio 2017 though.
So my VS 2015 was open and dsiplaying the now VS 2017 project. I believe it only contained one nuget package, however this was not downloaded correctly and instead the package was displayed as a missing file.
Maybe this is happening for you too?
Same problem in VSC 2021 version 1.63.
Solution - Removed project folder from workspace:
CTRL+Shift+P, search for and execute the
"Workspace: Remove Folder from Workspace" command.
Then reopened the project folder and was OK
I created the MVC application and build the solution in my local machine and it builds without error then I have uploaded that MVC application into TFVC. But, if i take a new workspace from the other developer machine or going for the Branching feature in TFVC, we have been endup with all the reference dll's which was showing deleted like below screen shot and the solution does not build successfully. We are not sure what its causing the issue. Please help us to resolve this issue. Thanks in advance.
Update
Actual problem i am facing here is, I run update-package -reinstall command in the Package Manager Console, it removed all the existing dll's and restored back all the dll and build successfully. But, After successful Build, I have checked-in the pending changes into TFS. But again if I am taking the new workspace from another developer machine, i am still endup with the same build error and missing reference like above screen shot again i have to go for the Nuget Package Restore. Is it a Correct approach? Appreciate your thoughts on this.
right click on the solution and select restore nuget package this may solve your issue then clean and build
check dot net framework version in both tfs and local version
you can also try
update-package -reinstall command to reinstall all referenced packages.
I think you should try restoring missing NuGet packages, check that the option is checked in VS Settings > NuGet.
I have read many of the answers on SO and NuGet (and the Internet in general, really), but I can't seem to overcome the problem I am having with NuGet package restore in Visual Studio 2015. I have the following scenarios.
Solution A Structure
--Project A
If I open and build Solution A I see the dialog box that shows the nuget package restore progress and the solution builds successfully.
Solution B Structure
--Project A
--Project B
However, assuming that I have never built Solution A (i.e. fresh pull from TFS), if I open and build Solution B I see the dialog box that shows the nuget package restore progress, but the build fails because Project A fails to build.
What appears to be happening is that that NuGet is restoring the packages for Project B, but not for Project A thus the build failure. To the point, if I look at the references for Project B all of the NuGet references have resolved, but the references for Project A are still broken.
A few points:
I have disabled source control integration for NuGet so I am not checking in the Packages folder.
Each project has its own packages.config file
The build order in Solution B is Project A then Project B
Thoughts would be greatly appreciated.
By default, NuGet creates the solution's packages folder in the solution root, and each project references its package DLLs to that "local" packages folder. In your example, if you open the .csproj file for Project A, you'll probably see that the reference path is something like ..\packages\[package name]\[etc].
So when you do a fresh pull from TFS and build solution B, Project A can't find its DLLs because c:\workspace\Solution A\packages doesn't exist yet (or whatever the absolute path is on your machine).
To correct this, use a shared package folder, created at c:\workspace\packages. To do this, you have to add an additional node to the NuGet.config in each solution (see https://docs.nuget.org/consume/nuget-config-file for details; I am also assuming you have a NuGet folder at c:\workspace\Solution A\.nuget):
<config>
<add key="repositorypath" value="..\..\packages" />
</config>
I used a relative path here, but you can use an absolute path as well, and the documentation says you can use %HOME% as well.
Do this, then restart Visual Studio. The next time you open the package manager, it should ask you if you want to restore missing packages, and assuming you click yes, it will put them in the new location. The last step is to edit the .csproj file and change all instances of ..\packages to ..\..\packages (or you can uninstall and reinstall the package, but I find editing the .csproj a lot faster).
To restore nuget packages do following steps:
Change target framework in project properties
Clean project
Set previous target framework
Rebuild project
I hope, it will help.
Taken from OPs question
howcheng's answer is generally correct with some caveats. After implementing the changes howcheng suggested, I was able to build all of my solutions locally using a central 'packages' folders that all projects look at, regardless of solution. The problem that I ran into though was that when I checked these changes in to TFS, my CI build kicked off and failed!
My CI Build Definition builds both Solution A and Solution B as part of the default XAML process template, not a .proj file. The errors that I was seeing seemed to indicate that Solution A was restoring its packages, but Solution B was not. If I logged onto the build server and opened Solution B in VS 2015 everything worked fine; after Googling for a couple of hours I came across this article which ended up leading me to my answer.
I am developing in Visual Studio 2015 but I am using TFS 2013 for source control and builds. Despite the fact that I have Visual Studio 2015 installed on the build server, MSBuild still references the version of NuGet that shipped with TFS 2013 and NOT with the version included with VS 2015. Once I ran nuget update -self from the TFS Tools directory my build worked correctly.