How can I update a NuGet package in multiple solutions without manually opening the solutions? - powershell

We use the Entity Framework 6.1.2 NuGet package in 6 solutions. EF was just updated to 6.1.3 and we want to update all of the solutions to use the newest version. Taking the naive route we would open a solution in Visual Studio, use the NuGet Package Manager to update the package, close the solution, repeat for next solution. Running Update-Package EntityFramework in the Package Manager Console is probably a little more efficient than using the GUI but still requires opening each solution individually.
I'd love to be able to run a script which finds all the solutions in a folder and updates the package for (all projects in) each solution. I realize that updating the version number in the packages.config is not the same as installing the new version of a package, so that (very simple) option won't work. I also realize that there's not much efficiency to be gained by doing this one time, but libraries are updated so frequently these days keeping up to date can become an (admittedly minor) annoyance. Is it possible to automate this task?

Related

Upgrading moodle 3.4 to 3.9

I am new to moodle and I need to do an upgrade. I have several questions first:
I have to upgrade from 3.4 to 3.5 and then to 3.9. Would I have to install all custom/aditional modules to 3.5 or can I do it just on 3.9.
This might be a dumb question, but I want to make sure I don't give anything for granted. In other to know which are custom/aditional modules I just have to go to the plugins view in administration and just copy the plugins that are on the section aditional plugins, right?
Thanks in advance
In general, you can get away with not installing all the custom plugins in 3.5. It is, in theory, possible that a 3rd-party plugin would choose to clean up their older upgrade steps, in the same way that core code does (which is why you can't jump direct from 3.4 to 3.9). I can't remember of any occasion where I've been caught out by a plugin doing that (and I've prepared hundreds of upgrades for different customers over the years). Note: you will see messages about plugins 'missing from disk' during the 3.5 upgrade step, but those should be fixed when you add the plugins back to the 3.9 code.
The list of additional plugins contains all of the plugins that are not part of the core Moodle code. It won't tell you about any custom changes that have been made to core Moodle files, but if you have simply been installing plugins and not messing around with core files (which is true in almost all cases), then you should be able to rely on the list.
Hopefully it goes without saying that you should always take a full database and moodledata backup before you start the upgrade, just in case there are problems (but, in my experience, they are fairly rare with normal upgrades).

Visual Studio can't resolve Nuget dependencies after reinstalling operating system

I recently reinstalled my Windows 10 OS, and now Nuget packages are "not compatible". After an explanation, I will be asking, how do I resolve this problem.
Lead up
Due to an unrelated problem, I had to reinstall my operating system. In the course of that, I reinstalled Visual Studio 2019. I cloned my repository (https://github.com/PaulSchrum/CogoDN), then opened it locally with VS.
Now when I build, I get several Nuget errors and warnings. These Nuget dependencies have been present in my code since December 2019, and never caused me a problem until this month (July 2020) associated with the reinstallation of VS.
Question: How do I resolve this problem?
Other Details
I am targeting .Net Core 3.1, but it happens no matter which version of .Net Core I target.
The main error seems to be of the pattern:
NU1202 Package System.Drawing.Common 4.5.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1).
This is happening for System.Drawing.Common, netDxf.netstandard, and packages necessary for Microsoft Tests. Specifically, it can't recognize using Microsoft.VisualStudio.TestTools.UnitTesting; (namespace 'VisualStudio' does not exist), and every attribute ([TestClass], [TestMethod]) now is a syntax error.
What have I already tried
Various combinations of reestablishing the Nuget packages. This includes at least twice clearing the Nuget cache and installing the dependencies again. I also followed the advice here: https://stackoverflow.com/a/63108317/1339950 (Item 3) Close VS, Delete global NuGet.config, start VS and let it rebuild Nuget.config.
None of these work.
One last note: I have tried so many things and got into various different states of not working that my description may have inadvertently conflated a few details.
Visual Studio can't resolve Nuget dependencies after reinstalling
operating system
It is quite strange and in my side, I can also build the project without any errors.(I download the project from your github link and then open it with VS0219----build well).
So I think your Net Core SDK or VS IDE have broken.
1), please try to install the latest Net Core 3.1 Developer SDK.
Or you could open Programs and Features from Control Panel, then right-click on every net core sdk-->Change-->Repair
2) run sfc /scannow to scan your os and you can refer to this link for more steps.
3), try to do a repair in VS Installer. Or if your VS2019 is not the latest, please update it to the latest version.
4) try to create a new net core project and then install these nuget packages to check if the issue still persists.

Nuget Package Compatibility and Upgrades

My company has internal components that we deliver via internal NuGet. Now i want to make a Version 5.X of these components which will be breaking a lot from the 4.X versions.
However now if my colleagues browse for updates, the Nuget browser would recommend these new packages.
What i would prefer: If example 4.6 is installed, it would take the highest 4.X version but not 5.0 or above. Making packages for the 5.X path under completely different names would be annoying when the developer choses to upgrade.
Is there a way to mark nuget packages to do something like that? If that's not clear, tell me and i try to clarify.
If your projects are using packages.config, you can use allowedVersions: https://learn.microsoft.com/en-us/nuget/reference/packages-config#schema
There's no way to do this if your project uses PackageReference, but you can upvote (👍) this isse: https://github.com/NuGet/Home/issues/9082

where did NUnit Gui Runner go? version 3.0.1

I just upgraded to version 3.0.1 from nunit 2.6.4. It used to have a NUnit Gui Runner, located here:
After installing 3.0.1 (which I downloaded windows version from here)
I now no longer see the nunit.exe in the installation folder, for example the directory structure is different and appears to be missing many files that were part of the previous installation:
The NUnit team decided to make the GUI a separate product and will be releasing it separately. It is being rewritten from the ground up for NUnit 3, but hasn't been released yet. Development is happening on the GitHub page at https://github.com/nunit/nunit-gui if you want to get involved or track the progress. Initial releases will be out soon.
Update - There have been several preview releases of the new NUnit GUI that can be found at https://github.com/nunit/nunit-gui/releases. The previews are not recommended for production use, but they work and can be used.
The "final" release is here, you can find it at: https://github.com/TestCentric/testcentric-gui/releases
For anyone coming to this page, looking where to find the NUnit Gui, please note that on http://nunit.org/?p=download you can get version 2.6.4, which does contain the Gui.
UPDATE
As pointed out in the comments, a lot has changed since, and you should no longer use the 2.x version tools, rather use the new TestCentric UI found at https://github.com/TestCentric/testcentric-gui/releases

How long is a package in NuGet available?

We use various packages of NuGet in our company for productive applications. But we do not know how long a particular version of a package is available.
We do not want to include the packages in the source control system.
To be precise. If our source code is older than 10 years, is then a package in a particular version still available?
With NuGet.org you can delist a NuGet package but not permanently delete it. Delisting removes it from the search results but it is still available for NuGet package restore.
That being said the NuGet team can permanently delete NuGet packages in exceptional circumstances. This has happened at least once, as far as I am aware, when Oracle asked the NuGet team to remove some NuGet packages that were using their software or could be mistaken as being supported by Oracle.
So in practice the NuGet packages will be available as long as NuGet.org is still around. However it is hard to predict what will be happening in 10 years time.
No one knows exactly how long a package is available. When a new version comes out, sometimes the old version is still available and sometimes it's not. AFAIK, they don't have a release schedule, so no one is ever sure when a new version is available until very close to the release date.