Does the new Symbol Nuget package allow editing the Nuget locally? - visual-studio

I'm investigating the new .snupkg extension for Nuget packages and was wondering if it allows me to modify the Nuget code in Visual Studio on the fly or do I have to pack and push my new changed Nuget everytime I make a change I want to test?

wondering if it allows me to modify the Nuget code in Visual Studio on the fly or do I have to pack and push my new changed Nuget everytime I make a change I want to test?
I am afraid we could not modify the Nuget code in Visual Studio with the new .snupkg extension and still have to pack and push my new changed Nuget every time.
That because the new .snupkg extension is used to improve NuGet package debugging and symbols experience instead of automatically synchronizing code for nuget.
There are several issues with the NuGet package debugging and symbols experience before, the new .snupkg extension creates a streamlined package debugging experience for the entire NuGet ecosystem.
So, the new .snupkg extension is used to optimize debugging of nuget, we could not modify the Nuget code in Visual Studio directly and if we have any change in the nuget package, we still have to pack and push it.
You can check following document for some more details info.
NuGet Package Debugging & Symbols Improvements
Hope this helps.

Related

Visual Studio Code - Not able to upload nuget packge that is created locally on my computer

So I have written two programs(Main program and Calculatorlib) on Visual Studio Code where I have created package locally for one of the programs(Caluclatorlib)by using the command dotnet pack.
The package Calculatorlib_package.3.0.0.nupkg is created locally.
However I want to upload this package on visual studio code from my local computer so that I can give Package Reference to Main program.
I don't see any options to upload this on visual studio code.
But in Visual studio I see there is an option called "Manage Nuget packages" where we can go and upload locally created packages.
Can someone guide me how to do this?
Try adding your local package location as a Nuget package source. You should be able to add a Nuget package source using the package configuration , and add the location of the directory when you have the Nuget package locally.

If I release an update to my nuget package but I don't change the version number, how does Visual Studio handle that?

Let's say I have a nuget package in my Nexus repository called MyPackage.1.0.0. I also have a solution in Visual Studio that has MyPackage.1.0.0 installed. If I make a change to my nuget package in Nexus but I don't change the version number, what happens in Visual Studio? Will Visual Studio know that the installed package is outdated? Will it automatically download the new version next time the solution is built?
No, Visual Studio will not detect this and will not use the updated package. Also, if you are using package reference nuget package management format, the package once installed gets extracted to the global packages folder. If you now try to install this package in a completely different project, nuget first looks in this global packages folder and if it finds it which it will, it will use it and not go to package sources to retrieve it again.
You can clear the local nuget caches by calling
nuget locals all -clear
from the command line.
After that, all packages will be downloaded again. This may be acceptable during development (i.e. if you need to tweak your package until it works), but clearly is not an option if others are using the same version already.

Is there a way to create package.config for development only in Visual Studio?

I have a list of nuget packages that I only use for development. I know in node you have devDependencies. Is there a similar way in visual studio? What's important for me is to control which packages gets carried over to production.
My team mate figured out the solution to this which is using conditional assembly reference. So the package will still be restored when the package is build but it won't be included in the deployment of the final build.
https://heejune.me/2016/02/17/c-conditional-assembly-reference/

Howto disable nuget machine-wide cache?

As you know NuGet uses %LOCALAPPDATA%\NuGet\Cache location for caching. It first checks if requested packages is here then download if needed.
How can I properly disable this cache mechanism from Nuget and "Visual Studio 2013", and make sure they always download from sources?
Can I build Nuget Package Manager Extension from source, then install it to Visual Studio? Or Are there any registry configuration that disable it?
Thanks
You cannot disable NuGet from using a cache. The only thing you can do without changing the source code is to change the location of the cache directory using a NuGetCachePath environment variable.
So you are left with clearing the local cache manually or automatically before installing a NuGet package or modifying the source code for NuGet's Visual Studio extension.
The source code for NuGet 2.8.5 and older is available on CodePlex.
The source code for NuGet 3.0 is available on GitHub
There are some instructions available on how to setup the NuGet development environment to be able to build and run NuGet within Visual Studio.
Currently it's possible to do so in case you'd running Install NuGet packages task through CLI which is common practice.
You can order NuGet to not use it's cache at all by using -NoCache input parameter. Then it will behave as you described. See CLI reference of NuGet.exe

Storing ancillary support packages within a visual studio solution

I was wondering about the right way to do this. For example, let's say you have a number of projects (part of a solution) that uses boost. Let's say you want to put the boost package in the solution so the entire thing is more portable.
How do you do that? Do you install boost in a directory within the solution? Can you reference it using relative directories, so it isn't portable?
Under Linux, for completeness, one could just store a tarball in the code under control, but it was left to the developer to bring it out and install it. I'm wondering how this is done (best practices) under visual studio.
[NOTE: I understand this might make the solution large, but the benefit would be a development environment that would run immediately without a bunch of package installs for each development system accessing the code.
In this case you could use the nuget package manager in visual studio to add the nuget boost package to your solution then boost will be available to the projects that need it. You can then enable package restore so that whenever the solution is built if the boost files are missing from the solution then nuget will restore them on build.
If you haven't already you will need to install the nuget package manager plugin for visual studio.
Where the package isn't available on nuget there are a number of options; you can build the package and then reference the assembly that's been built - you just store assemblies you need in a references directory. If your using source control software Svn or tfs possibly git ( I don't know) then you can store these in source control and then include them in the target solution via links. The final option I can think of is you can build the package into a nuget package and then store the result in your own private nuget store visual studio allows for this. Which solution works for you will depend on the size of the project, development team and the source control software you use.

Resources