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

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.

Related

Timeline and visual scripting packages are broken after Upgrading Unity to newer version

Earlier this week, my work upgraded Unity from 2021.3.1f1 to 2021.3.13f1. My coworker did this first and I pulled the changes (we are using Plastic SCM) I got these errors:
This is happening for both the Timeline and Visual Scripting Package
I thought that it might be due to being on the wrong version of Unity so I installed the 2021.3.13f1 version and the errors were still there. I have done many different things to try and fix this, but the problem still persists. Here are some of the things I have already tried:
Re-imported both my Assets and Packages folders
Deleted the whole project and re-downloaded it
Reinstalled the new version of Unity
Reset packages to defaults
Used a replace my package cache file with a co-worker's
Used a different workspace and branch in Plastic.
Tried using an entirely different project (the problem persisted in all projects)
Deleted the project and re-created it through cloud saves
Removed both of the packages from the project via the package manager and installed them again (this actually removed the visual scripting error when the package was removed, but the timeline errors persisted)
Using an older version of unity.
This apparently has not affected any of my co-workers and is only happening on my computer. I thought fresh installing EVERYTHING would fix it, but no.
Thanks for the help.

#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!

Getting error in AWS toolkit for Visual Studio: Error loading AWS profile

I have installed AWS SDK toolkit for VS 2017. It was working fine. All of a sudden since few days back i am getting error "Error loading AWS profiles: Method not found:'Amazon.Runtime.TcpKeepAlive Amazon.Runtime.ClientConfig.get_TcpKeepAlive()"
I have tried uninstalling and reinstalling the toolkit, also i tried installing it on other machine with VS 2013, but both giving same error.
Is it problem with toolkit or anything changed on AWS side?
I have Windows 10 with latest updates.
VS2017 community edition
VS2013 community edition
Thanks in advance.
It is mostly caused an older version of AWSSDK.core that has already been added to GAC and is forcing your VS to use an older version of AWSSDK.core.dll.
After uninstalling all the other/previous versions of AWSSDK libraries (AWSSDK.S3.dll etc) from GAC solved the problem for me.
Also installing the latest AWSSDK.core.dll to GAC can work.
Hope this info helps someone.
Solution here that worked for me :
https://github.com/aws/aws-sdk-net/issues/1138
I have resolved this issue by uninstalling the latest one and installing this previous stable version of aws toolbar from visual studio update website(exact link https://aws.amazon.com/visualstudio where previous vsix downloaded).. if you cannot find the previous version here I added to my drive you can download.. https://drive.google.com/open?id=1Fkrxmv-dM8fwGDjNqse1Ssdm0k3YYbcH
Once you install old extention, be sure to disable auto update extension in VS.

azure mobile service .net backend not working after nuget packages update

After updating the nu-get packages for a previously working Azure Mobile Service (.Net back-end), I now get the following error when accessing Table Controllers:
An error has occurred.","exceptionMessage":"Object reference not set to an instance of an
object.",
"exceptionType":"System.NullReferenceException",
"stackTrace":"at Microsoft.WindowsAzure.Mobile.Service.Serialization.
SelectExpandWrapperConverter.ODataReflectedTypes..ctor()
at Microsoft.WindowsAzure.Mobile.Service.Serialization ...
Custom Controllers appear to be unaffected.
I've probably missed something obvious, but I can't see it
Any help would be appreciated
Many Thanks
K.
From Henrik F. Nielsen's answer in the MSDN forums:
There are known incompatibilities with the latest version of ASP.NET Web API which was released the same day as our last update. We are working on an update but in the mean time please don't update all your NuGets but only the WindowsAzure.MobileServices.* packages -- they will then include the right dependencies the need.
This is an integration issue with the .NET backend binaries, and it should be resolved soon.
Expanding on #carlosfigueira's answer, it seems that the WepApi 5.2.0 version is not compatible with Azure Mobile Services yet.
I am one of the unfortunate ones who decided to let nuget go to town and update all the packages in the project so here is what I did to deal with this.
Uninstall every nuget package from your mobile service project. Then add them back. Start by using only the Microsoft Azure Mobile Services.NET Backend.* packages - This will pull the currently compatible WebApi 5.1.2 instead of 5.2.0. and other dependent assemblies.
In addition, I was getting a lot of weird redirect binding errors which I believe the tooling added incorrectly - so I commented out all the dependentAssembly tags in the assemblyBindings and then added them back as the mobile service complained. All I had to add back for redirects were Newtonsoft.Json and Microsoft.Owin. YMMV.
I think this may also have something to do with the fact that there are strange interactions between VS and source control plugins since nuget packages sometimes fail because they can't obtain write permissions for packages.config and web.config files.
I am also using a PCL in my service which requires adding the Microsoft.Bcl libraries - perhaps irrelevant but it is what lead me to discovering the underlying error.
Under Tools -> Options -> Projects and Solutions -> Build and Run, set the MSBuild project build output verbosity to Detailed or above to get some insight into what is happening in the process.
[Update 12/24/2014]
I updated something I shouldn't have and everything broke again.
Uninstall all nuget packages. Delete all dependentAssembly elements from the Web.Config file. Save and restart Visual Studio.
Start adding packages back using the following from the Package Manager Console. In my case:
Install-Package WindowsAzure.MobileServices.Backend -Version 1.0.405
Install-Package WindowsAzure.MobileServices.Backend.Tables -Version 1.0.405
Install-Package WindowsAzure.MobileServices.Backend.Entity -Version 1.0.405
Install-Package WindowsAzure.MobileServices.Backend.SignalR -Version 1.0.405
Install-Package WindowsAzure.MobileServices.Backend.Storage -Version 1.0.405
Never touch it again...?

Migrate Enterprise Library 4.1 to 5.0

We are using enterprise library 4.1 and smart client software factory 2008 to our application.
how we can upgrade enterprise library 5.0 and SCSF 2010 to our application.presently we are using visual studio 2008.
To upgrade what are the thing needs to be taken care.
Early help would be appreciated.
In terms of Enterprise Library, the best case scenario would be to replace the 4.1 assembly references with 5.0 assembly references and change the configuration (to use 5.0 references instead of 4.1 references). However, you could also hit some issues.
You should read the Microsoft Enterprise Library 5.0 Migration Guide for a full description. The Breaking Changes document could also help you determine if you may run in to migration issues.
For the Smart Client Software Factory the approach appears the same: change the references and configuration to use the new dlls. The Web Client Software Factory 2010 Documentation download has a section on Migrating to Visual Studio 2010.
Install the 5.0 package.
remove all the previous refreneces and add the newer ones generated.
You can refer the dlls by copying it to some folders or directly from the location where you have installed (C:\programfiles\Microsoftenterpriselibrary5.0)
I faced the below issues while migrating
Configuration errors in web.config files - some of my references in the web.config files were refering to the older version(2.0.0.0)(i upgraded from 2.0 to 5.0) and the publictokenkey="null"
so i pushed all the dlls to the gac and added the publicktokenkey from the c:\windows\assembly. which solved the issue
And another issue was regarding the microsoft.practices.enterpriselibrary.caching.cryptography- it was displaying soem weird error.- solution-the bin folder was having the old dlls and when tried to
clean the solution the dll reference was still there. SO i deleted all those from the folder and rebuild again.
IT was initially having the logicacmg.enterpriselibraryextensions.logging which caused some issues- i used the microsoft.practices.enterpriselibrary.logging.configuration.rollingflatfiletracelistenerdata which could solve the issue.
Hope some one might get some inputs with this post