Cannot add MVVM Light libraries through NuGet - nuget

I'm trying to add MVVM Light to an existing project through NuGet but I get this error message:
Attempting to resolve dependency 'MvvmLightLibs (≥ 4.2.30.0)'.
Attempting to resolve dependency 'CommonServiceLocator (≥ 1.2)'.
Successfully installed 'CommonServiceLocator 1.2'.
Successfully installed 'MvvmLightLibs 4.3.31.1'.
Successfully installed 'MvvmLight 4.2.30.0'.
Successfully uninstalled 'CommonServiceLocator 1.2'.
Install failed. Rolling back...
Could not install package 'CommonServiceLocator 1.2'. You are
trying to install this package into a project that targets
'.NETFramework,Version=v4.0,Profile=Client', but the package
does not contain any assembly references that are compatible
with that framework. For more information, contact the package
author.
I've tried retargeting my project to .NET framework 4.0, 4.0 client profile, and 4.5. Any ideas? I wasn't having this issue as recently as two weeks ago.

Had the same Problem today. Try to install the newest Version of Nuget in your Visual Studio Addins first !

I am able to install while targeting 4.5 and using Nuget for "MVVM Light Libraries only"
Does installing https://www.nuget.org/packages/CommonServiceLocator/1.2.0 first avoid the issue for you?

I had the same issue. Updated Visual Studio 2012 to Update 4, tried again and it worked perfectly. Good luck!

It sounds like your project is targeting .NET 4.0 while you are installing library witch are not compatible to the targeted version.
Please find appropriate version of library and install them

Related

#postsharp Unable to compile after adding PostSharp.Community nuget package (on a Mac)

I'm using a Mac with Visual Studio 2019. I've added nuget packages: PostSharp and PostSharp.Community. I have NOT changed any code. I wasn't NOT prompted to select a license. I'm simply trying to compile, and I get the following errors.
/var/tmp/postsharp/cache/DependencyRestore/6.0.101/net6.0-sdk6.0.101-osx-x64--ps6.10.6.0-cf0d89f.deps.proj
: error NU3034: Package 'System.ValueTuple 4.4.0' from source
'https://api.nuget.org/v3/index.json': This package is signed but not
by a trusted signer.
/var/tmp/postsharp/cache/DependencyRestore/6.0.101/net6.0-sdk6.0.101-osx-x64--ps6.10.6.0-cf0d89f.deps.proj
: error NU3037: Package 'System.Security.Cryptography.ProtectedData
4.4.0' from source 'https://api.nuget.org/v3/index.json': The repository primary signature validity period has expired.
My project is targeting framework NetCore3.1. I don't know why PostSharp mentions net6.0.
As soon as I remove the PostSharp packages, it compiles fine.
Any help, would be greatly appreciated.
Thanks,
Jason
You probably have .NET 6.0 SDK installed on the machine and it is the active SDK (the highest version is usually used by default). PostSharp always executes under the runtime associated with the current SDK.
You should use the global.json file to specify SDK for .NET Core 3.1. This would cause PostSharp to run on .NET Core 3.1.
If this does not help, it means that PostSharp's dependency packages cannot be installed from nuget.org.
You can disable PostSharp's dependency restore by setting DependencyRestoreDisabled=True (either as env var or MSBuild property) and make sure that the project that was generated into /var/tmp/postsharp/cache/DependencyRestore/<SdkVersion>/<id>.proj has all it's dependencies present in the \var\tmp\postsharp\NuGetFallback directory.
Disabling the dependency restore disables automated checks and presumes that PostSharp can find all its dependencies on the machine.
I added the global.json, removed SDK 6.x. Set PostSharpDependencyRestoreDisabled=True and then I had to manually add all the referenced Nuget packages. It was annoying, but at least it works now.
Daniel, wetween both your responses, I was able to get it fixed!
Thanks!

Can I use Microsoft.EntityFrameworkCore in a standard .NetFramework solution in Visual Studio 2019?

Does Microsoft EntityFrameworkCore work with standard .Net Framework applications?
I read a couple posts which said it was possible to.
However, when attempting to install via NuGet Package Manager, I get the following error message:
Could not install package "Microsoft.EntityFrameworkCore.Design
5.0.0". 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.
Is there something I'm doing wrong, or is EntityFrameworkCore not intended for use with standard .NetFramework applications?
Sorry, I have to correct my answer, I was wrong. EF Core 3.1 can be used with .NET Framework 4.7.2 or later.
EF Core 5.0 cannot be used with .NET Framework 4.7.2
see https://learn.microsoft.com/en-ca/ef/core/miscellaneous/platforms
I also tried it before and got the same error message described above

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 Installation of EntityFramework

I have been doing some testing between VS2015 and VS2017. I created a .NetFrameworkApp and a .NetCoreApp website in both systems. I then installed a couple of packages in all four websites; in particular EntitytFramework. It installed in both VS2015 websites and the VS2017 .NetFrameworkApp website without problem but it wouldn't install in the VS2017 .NETCoreApp website. I got the following error messages.
net45 (.NETFramework,Version=v4.5)
One or more packages are incompatible with .NETCoreApp,Version=v1.1.
Package restore failed. Rolling back package changes for 'RLSBCWebSite_NC'.
Time Elapsed: 00:00:01.4470850
Error Package restore failed. Rolling back package changes for 'RLSBCWebSite_NC'. 0
Anyone any idea why that should be. I am assuming it should install otherwise how would you use CodeFirst etc.
The "EntityFramework" package is not supported with .NET Core App, use the:
Microsoft.EntityFrameworkCore.SqlServer
package instead

Unable To Install Jint 2.1.0.0

I am trying to use Jint in my C# WinForms Application but NuGet is refusing to install the package. I can install other packages perfectly fine including this one called JavaScriptEngineSwitcher.Jint. I googled around and couldn't find anyone else with the same problem. The error says it has a problem with the .NET Framework version but it is my understanding that 4.0 should be just fine (even so, I played around with it but nothing worked).
https://www.nuget.org/packages/Jint/2.1.0
The package does work fine in .NET 4.0 packages. Make sure you have the latest update of the Package Manager console. If it is updated or udpating doesn't work, try restarting Visual Studio and try again.