I've been installing Nuget packages and it seems that their just stick in the project. I've found a folder C:\Program Files (x86)\Microsoft SDKs\NuGetPackages, but its seems that it isn't updating the packges.
I recently installed sqlite and I went there to see if it made a change, but it didn't.
I also have the package that I want to install in .nupkg format or find a way to import it.
Is there a way to install NuGet Packages so that they stay on the Machine and not on the project folder it self?
This video solves my 90% of question, as I said above I have the .nupkg file, this videos helped me to install, it still won't be in the Machine. But it seems that Nuget get saved in the machine, not installed.
Install Nuget from a local source
Related
I'm helping a colleague who cannot get a Visual Studio WPF project to build in our TFS 2015 build server. I've pulled (get latest) the latest version of his code into my VS 2019 instance. I can't get it to build on my dev box. When I try to build the solution on my dev box I get errors like thing:
The tag 'ModernDialog' does not exist in XML namespace 'http://firstfloorsoftware.com/ModernUI'.
The tag 'Interaction.Triggers' does not exist in XML namespace 'http://schemas.microsoft.com/expression/2010/interactivity'.
When my colleague checks in changes into TFS, it fails with errors like this:
Unable to find version '5.2.0' of package 'MvvmLightLibs'.
Unable to find version '1.0.9' of package 'ModernUI.WPF'.
I started by trying to update the NuGet packages he had in the project, but that hasn't worked well. Even restoring back to the latest version doesn't build on my machine.
My colleague's approach is to rip all NuGet packages out of the Visual Studio solution, then look around to find the DLLs, then put them into the project and reference them in the project. It does build on his system but doesn't on the TFS build server.
So, I've been looking around for probable causes. I came across this Microsoft document Migrate from packages.config to PackageReference. I'm not familiar with either packages.config or PackageReference, but I get the feeling that PackageReference is the "preferred" way of including NuGet packages.
This raises problems. Currently our TFS build server's highest version of Visual Studio is VS 2015. According to the referenced article, VS 2015 uses packages.config files. Anything newer than VS 2015 uses Packages (PackageReference I presume).
I've compared the failing WPF solution with another one I've worked on which builds fine on the build server. The solution that builds, I'll call it SolutionA, has a packages folder at the root of the solution, but it also has packages.config files in each project in the solution. The solution that fails to build, I'll call it SolutionB, has the packages folder at its root, and one packages.config file in the unit test project. (I think the unit project builds fine.)
Even though we're working with newer versions of Visual Studio, I suspect that the problem the build server is having is due to the build server having an older version of Visual Studio. We have a limited number of licenses for Visual Studio, so I can't put a newer version of Visual Studio on the build server. So, how do I get those packages.config files into each projects?
First, your solution actually uses packages.config nuget management format. And this format makes every project has a file called packages.config which lists all the nuget packages and their versions. That is the feature of packages.config nuget management format. So you should also make sure that you have commit that file into TFS.
Second, that migrate packages.config into PackageReference is not an easy work and it should be done with VS IDE. Mostly, you have to make a big change to every csproj file of the project. Actually, PackageReference is flexible and lightweight, it does not have the packages.config file and packages folder which stores all the nuget packages. Just embed them directly in proj file. And so far, PackageReference is the mainstream.
Your problem is that you did not do a nuget restore operation on TFS build to make the missing nuget packages under the packages folder so that build process will find those nuget packages and make them work.
You should add a nuget restore xxx\sln command line or task.
Please check one,two,three.
I am working in an ASP.NET website (Website-A) code base which consumes an in-house NuGet package dependency.
Website-A consumes a pre-release of a NuGet dependency (Dependency-A). Opening Website-A and looking at "NuGet packages for solution" shows that Dependency-A is currently installed. Running "Restore NuGet packages" runs normally with no errors.
Rebuilding this .NET solution should result in a directory being created in one of the projects. (This directory will not be "included" in the project of Website-A, but the folder should be visible. I have clicked the "show all files" button.)
The issue is that this directory does not appear after rebuilding, nor after re-installing the dependency in NuGet package manager and then rebuilding.
We have discovered that if we manually delete the "packages" folder in the solution, and then "Restore NuGet packages", then rebuild the solution, the dependency will now create the directory like it should. It seems to need the "packages" folder to not exist in order to work like it should.
My question is: Is there something I am missing as far as a setting to automatically delete the packages folder? I would like to avoid having to manually delete this folder every time I need to update to a new pre-release of a NuGet package (we do a lot of this). I am using Visual Studio Enterprise 2017.
My question is: Is there something I am missing as far as a setting to
automatically delete the packages folder?
I'm afraid the answer is negative. AFAIK, VS doesn't have the option to delete the packages folder in Solution directory since it's not a normal way to do package update or package restore.
In addition: Do the pre-release packages have different names like packageName.1.2.0-beta1.nupkg,packageName.1.2.0-beta2.nupkg?
If your pre-release packages have different versions, and you update them using Update button in VS Package Manager UI, I think this strange issue you shouldn't encounter this issue. And if you have both projects in your local machine, it's not a good choice to develop locally with nuget packages...
I am using Visual Studio 2017 and pull the source code from TFS server, then build the solution, I got the following error:
Microsoft.Common.CurrentVersion.targets (3863,5): Error MSB3113: The
file "SqlServerTypes \ x64 \ SqlServerSpatial140.dll" was not found.
Then I found this dll file comes from the nuget package sqlserver.types, as I know, Visual Studio will restore the nuget packages when we build the solution.
Why I still have this issue?
File was not found after nuget restore
When you download the nuget package Microsoft.SqlServer.Types from the nuget.org and open it with nuget package explorer:
You will find the sqlserver.types nuget package not only includes .dll from .net framework, but also has native binaries files. These files are designed with x64 and x84, they could not added to lib folder directly. So the package owner adds them to project as content. However, these dll files is setting to ignore by default for TFS, you need to add them manually.
Of course, you can also use the command line Update-Package <package_name> –reinstall to reinstall this nuget package, but this requires you to execute this command every time after you pull the code from the TFS server. Add this native binaries to the source control will Will reduce these unnecessary troubles.
Hope this helps.
You can try this:
Update-Package <package_name> –reinstall
I am unable to either fresh install 10.0.2 or upgrade from 10.0.1. The error I always get is tons like this one, where it clearly can't access the folders.
Packages directory here \Newtonsoft.Json.10.0.2\lib\net20\Newtonsoft.Json.xml could not be found in your workspace, or you do not have permission to access it.
If I check the packages directory I indeed only have a 10.0.1 folder, even with fresh install.
Edit: If I open a explorer window in the directory, and constantly hit F5 during "upgrade", I can see that a 10.0.2 folder gets created. It gets deleted as soon as the upgrade fails.
Edit2: could this be related to TFS somehow?
This looks like this issue:
TFS Error "[file]not be found in your workspace, or you do not have permission to access it" during upgrade or uninstall when solution/project is bound to TFS source control
the bug is during uninstalling packages, nuget will delete package
files from TFS, but if user set disableSourceControllntegration to
true, package files are not added to TFS workplace during installing,
so TFS can't find those files during uninstalling. (sic)
The fix is to install the latest version of nuget.exe (3.5 or later), which you can find here.
We have a .csproj that is being worked on by a number of people.
Unfortunately nuget has installed its 'packages' in different locations on each users machine, meaning when another user does an SVN 'update', their project wont compile because the .csproj file's 'hintpath' element is pointing to the dll in a different location.
Are there any other solutions to this?
Use NuGet packages restore feature and don't commit packages to source control.
This allows NuGet client application to download packages on demand. Downloaded packages will be located in solution folder, so, references to packages content will work at any machines.