We help IT Professionals succeed at work.

dotnet error

High Priority
258 Views
Last Modified: 2019-04-23
I use Angular CLI with Visual Studio Code
After auto system update my computer I was unable to start my server part of Angular application
 with "dotnet run", tried to use "dotnet restore" and got error:
error NU1100: Unable to resolve 'Microsoft.NET.Sdk ' for '.NETCoreApp,Version=v 2.2'.
How to resolve this?
Comment
Watch Question

Kelvin McDanielSr. Developer
CERTIFIED EXPERT

Commented:
If you have Visual Studio 2017 and 2019 installed on the same machine you might not have the correct point release of .NET Core v2.2 for your application. Even if you don't have 2019 installed, you still might not have the release that you need.

.NET Core SDK v2.2.203  is for Visual Studio 2019. Even though it seems like it should work with your existing code, it does not work properly unless you have Visual Studio 2019 installed.

.NET Core SDK v2.2.106  Is the latest, stable release that works with supported earlier versions/configurations.

You can download both installers here.

If you find that you need to remove a particular version and/or SDK, follow the instructions here.
ybt

Author

Commented:
I'm working with Visual Studio Code, this is not Visual Studio, is .NET Core SDK v2.2.106 preferable anyway?
Kelvin McDanielSr. Developer
CERTIFIED EXPERT

Commented:
Absolutely, it is necessary unless you are *ONLY* using Visual Studio 2019.
ybt

Author

Commented:
I uninstalled .NET Core SDK v2.2.203 and now I have previous version .NET Core SDK v2.2.105
when I tried "dotnet run" got following error:
A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in
'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.4'.
Sr. Developer
CERTIFIED EXPERT
Commented:
Without seeing your project configuration file, it sounds like your config has gotten mangled or is missing some key elements.

One that might help immensely is outline here, which is adding emitEntryPoint to the buildOptions setting.

Another is to ensure the specified .NET Core SDK/Runtime in the configuration is what it needs to be for .NET Core SDK v2.2.105. I don't know those exact values of the top of my head; the easiest thing to do would be to create a new project targeting the .NET Core SDK v2.2.105 and refer to the config file created there.
ybt

Author

Commented:
Thank You!