I'm trying to get started with c# (I've been using VS for C++ without issue) and whenever I try to open a C# Project I get this error:
The project file cannot be opened. The SDK resolver "Microsoft.DotNet.MSBuildSdkResolver" failed to run. Illegal characters in path.
The .csprj only has 7 lines!
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>
I tried swapping the "
for '
but got the same error.
Running VS2019 with /ResetSkipPkgs
prevents this issue from happening and the project loads fine. However I can't find the source of the issue.
Does anyone else know what could be causing this? I'd like to be able to work on C# projects without running VS via commandline every time!
Does anyone else know what could be causing this? I'd like to be able to work on C# projects without running VS via commandline every time!
Not sure what you did to your VS before. Maybe this issue is caused by some third party integration tools, vs extensions, or some VS Settings.
Suggestion
Please try the following steps:
1) make sure that your VS2019 has installed these two workloads
2) check System Environment Variable PATH and make sure that it has value C:\Program Files\dotnet\
and no other space keys.
Also, check if you have environment variable MSBuildSDKsPath, if so, you should check if its value exists and enter the path to check it. If not, you should modify to use the address that already exists.
If MSBuildSDKsPath does not exist, you should add it and set its value to
C:\Program Files\dotnet\sdk\3.1.xxx\Sdks
Make sure the path exists under your PC.
VERY IMPORTANT: Don't use quotes in the variable value and finish it with a \
. So please check every environment and make sure that there are no garbled characters.
3) open VS IDE, click menu Extensions-->Manage Extensions and enter into installed extensions and then disable any third party extensions to check whether the issue is caused by them.
4) Reset all VS settings by Tools-->Import and Export Settings-->Reset All Settings or just run devenv /Resetsettings
.
5) repair VS or update it to the latest version if there is any updates.
6) delete the .vs
hidden folder under the solution folder, bin
and obj
folder and then test again.
================================================
Besides, you can directly add the switch into /ResetSkipPkgs
into VS icon so that every time when you open VS, it will run the /ResetSkipPkgs
at the same time.
Right-click on the VS2019 Shortcut icon-->Properties-->Shortcut
Add /ResetSkipPkgs
into the
Click Apply and Ok to enable it.
Note: when you use it, you should open VS by clicking that icon rather than start it under VS Installer which does not support that feature).
If you start VS2019 in Start Menu, you should modify the Shortcut by my function in C:\ProgramData\Microsoft\Windows\Start Menu\Programs
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With