i want to do 'check in' to code uses Nuget package.
what is the the best way to do it?
Do i need to do 'check in' to the package folder?
Is there any way to put the dll's (nuget's dlls) in GAC and add them public key token?
My solution is written in c# .net framework 4.5. TFS version - 2015
thanks!
You should not check in NuGet packages into TFS Version Control. As one of the advantages of using NuGet is that you can use it to avoid checking in binaries to your version control system.
In VS, you can enable package restore:
In TFS, you need to restore NuGet packages during TFS build process by adding a "Nuget Package Restore" task to your build, and the required packages will be downloaded.
More information, refer to this article: https://docs.nuget.org/ndocs/consume-packages/package-restore
Related
In my company, NuGet packages are coming from different sources:
nuget.org (http://api.nuget.org/v3/index.json)
Microsoft Visual Studio Offline Packages (C:\Program files (x86)...\NuGetPackages)
Company_NuGetFeet#local (https://Company.pkgs.visualstudio.com/_packages/.../nuget/v2)
Supervision (some http://10.1.3.xxx/nuget site)
When I start up Visual Studio, I get logged in automatically (at the above right corner, I can see my login settings).
I have access to some NuGet packages and there are some where I don't have access to:
Company.Something.UA : OK
ControlzEx : OK
DevExpress.Chartsv18.2_Core : NOK
I have been doing NuGet restore in lots of ways: normal commandline, developer prompt, using the standard NuGet.exe, using the latest NuGet.exe, from within the company network, from outside the company network, ..., it does not make any difference.
In order to pinpoint the problem, I was thinking of restoring a single NuGet package, which should come from one specific package source, but what is that source?
When checking the properties of NuGet packages (being OK or not), the package source is not mentioned.
So I would like to do:
NuGet.exe restore DevExpress.Chartsv18.2_Core DevExpress..._Core_Package_Source
How can I do that?
How can I know from which package source I need to download a specific NuGet package?
There is no link. Package restore searches all sources in nuget.config (either system-defined or project-defined) for a package, in the order those sources are specified, and installs the first matching package it finds.
What you're really asking is "how do I install a package from a specific source", and you can do that with dotnet restore. Note that NuGet.exe is legacy and deprecated; its package restore functionality is integrated into the dotnet tool and improved there.
> dotnet restore MyPackage -s NugetSourceName
There is no way to know which source a package is available in without browsing it, but as stated above it shouldn't matter; package restore will figure it out.
Now (with .NET 6 tooling) you do have a way to pin packages (patterns) to specific package sources. The feature is called "Package Source Mapping":
https://learn.microsoft.com/en-us/nuget/consume-packages/package-source-mapping
https://www.youtube.com/watch?v=G6P38Dn69Ro
https://devblogs.microsoft.com/nuget/introducing-package-source-mapping/
I'm trying to install emgu.CV.runtime.windows from within Visual Studio 2017, and installing by the recommeded method of right-clicking references and installing via NuGet.
However I am getting the error below.
Could not install package 'Emgu.runtime.windows.msvc.rt.x64 19.28.29336'. You are trying to install this package into a project that targets .NETFramework,Version=v4.7.2, but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
According to the package information, its dependencies are
enter code here.NetStandardVersion=2.0
enter code here.Engu.CV (> 4.5.1 && < 4.5.2)
enter code here.Engu.runtime.windows.msvc.rt.x86 (= 19.28.29336)
enter code here.Engu.runtime.windows.msvc.rt.x64 (= 19.28.29336)
I checked and c:\windows\Microsoft.NET\Framework contains a folder for v2.0.50727, so it seem .net 2.0 is installed (as is v3.0, v3.5, v4.0.30319)
I have emgu.CV 4.5.1.4349 installed.
I need this library so that I can have the enter code herebitmap.ToImage<Bgr, byte>(); function.
Why am I getting this error?
Any help would be greatly appreciated.
The solution is migrating from package.config to package references for every project you have. Simply right click on package.config and click "migrate package.config to PackageReference".
Then, install the runtime package again and it will work.
For the new Emgu Nuget package you do need to use PackageReference instead of the traditional package.config.
What worked for me on Visual Studio 2017:
Uninstall all NuGet Packages [This removes the package.config file]
Go to Tools --> Options --> NuGet Package Manager --> General
Change the default package management format to "PackageReference"
Check "allow format selection on first package install"
Click OK
Install Emgu.CV, Emgu.CV.Bitmap, Emgu.CV.UI and Emgu.CV.runtime.windows
These Emgu packages should now appear under your references and you should not see a package.config file.
Nuget Options Image
I encountered the same error. I don't know why we're getting it, but I was able to find a workaround.
Visit the nuget page for the package.
Click "Download Package" to download the nuget package directly.
Open the downloaded file using your archive utility of choice and navigate to the "\runtimes\win-x64\native" folder.
Copy both dll files into the output directory of your project.
After doing this, my code executed without error. Make sure to install emgu.CV.Bitmap as well.
I changed my projects Target Framework to ".NET Framework 4.6" and then went to "Manage NuGet Packages", selected "Browse", typed in "emgu.cv.runtime" then installed version 4.5.1.4349 and it worked.
Here is how I solved it,
1- downgrade .Net framework to 4.6 from project properties
2- Uninstall Emgu.CV and related ones (you will see which ones needed to be uninstalled in Errors List)
3- Install Emgu.CV.runtime.windows from Solution Nuget Manager ( it should install fine now)
3- upgrade .Net framework to 4.8
4- install Emgu.CV 4.5.1 (latest)
5- install Emgu.CV.UI 4.5.1 (Emgu.CV.Bitmwp was installed automatically for me)
and that's it, now you can use bitmap.ToImage<Bgr,Byte>(), note that the Image<Bgr,byte>(bitmap) doesn't work anymore.
I am on a Mac using .net core 2.0 and Jetbrains Rider. I have a network folder where I publish my private nuget packages.
nuget push <packagePath> -source <localNugetPath>
I delete a package from the local folder.
nuget delete <packageID> <packageVersion> [options]
This deleted the nuget package from the network folder but yet it still shows in Rider as an options.
nuget list [search terms] [options]
The above nuget list command will also show the package. How do I permanently get ride of the package?
NuGet does not allow for package delete and instead relies on unlisting the packages. This means:
This unlisted version is not shown in new searches and hence will not get auto resolved to, in new projects.
However, existing projects that have references to this unlisted version continue to work as before. (And that's one of the reasons for not allowing delete - so that existing projects do not break)
The package can shows because it cached. To clean all cache use command:
nuget locals all -clear
Is it possible to delete NuGet packages from a Visual Studio Online package feed?
I've setup CI on Visual Studio Online using the Build Tasks for a dotnet core project.
One of the steps is to pack all the projects in the solution as NuGet packages and push these to the package feed.
The build is working fine, however in my first attempt in the pack and push build steps I used a **/.csproj wildcard instead of src/**/.csproj. So it packed and pushed all my test projects too that were under tests/**.
I'd like to delete these packages from the feed. The only option I could find in the UI was to unlist the packages. But the packages still exist after this operation.
I also tried to delete the packages through the CLI: nuget delete. But it just does the same as unlist.
Has anyone been able to delete their packages?
Yes, this is possible out-of-the-box with VSTS' Package Management. Note that there is a difference between unlisting and deleting, which I'll elaborate on further.
The TL;DR story for deleting existing packages from VSTS Package Management is that you must be the 'owner' of a package OR have a 'Project Admin'-like role in order to delete it. To unlist a package, you only require the 'contributor' role. For both options, simply go the package details in VSTS and select the appropriate option from the menu under the ellipses:
Now for some background info which might be useful. There is some official documentation available on visualstudio.com:
There are two options available to remove a version of a NuGet package from a feed.
Unlist: unlisting a version of a package modifies how the package appears in NuGet clients (see the NuGet docs for a full description of how unlist works). Unlisting a version can help you prevent new usage of it without breaking dependent projects and builds.
Delete: Deleting a version of a package makes it permanently unavailable for install or restore.
Unlist and delete both respect feed immutability. Once you publish a particular version of a package to a feed, that version number is permanently reserved. You cannot upload a newer revision package with that same version number, or delete it and upload a new package at the same version.
The important part here is "feed immutability", which according to the canon, translates to:
Once you publish a particular version of a package to a feed, that version number is permanently reserved. You cannot upload a newer revision package with that same version number, or delete it and upload a new package at the same version.
The documentation also confirms, as a footnote at the bottom, what you already discovered about nuget.exe:
Currently, NuGet.exe can only unlist packages; Team Services and TFS interpret nuget.exe delete as an unlist operation to be consistent with NuGet.org. To delete a package, you must use either the REST APIs or the web interface.
Doing it programatically should therefor either be done through the REST API or the VSTS admin section, as described above. NuGet.exe can only be used for unlisting - not deleting.
With all of that taken into consideration, with VSTS you can delete packages but - as always - think twice before you do so. Remember the LeftPad debacle? ;)
I have some 3rd party DLL's i need migrating into a TFS Nuget Feed, and I haven't been able to find many articles on the internet about installing specific versions of a given Nuget Package at runtime, could anybody link me to some relevant material and/or provide some pointers to this effect?
Ideally this would be done as an MSBuild Target I think?
Thanks in Advance :)
To promote a cleaner development environment and to reduce repository
size, NuGet Package Restore installs all referenced packages before a
project is built. This widely-used feature ensures that all
dependencies are available in a project without requiring those
packages to be stored in source control (see Packages and Source
Control on how to configure your repository to exclude package
binaries).
This should help NuGet Package Restore
One of the topics
MSBuild-integrated restore in Visual Studio, for NuGet 2.6 and
earlier.