question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

startvs.cmd == no projects loaded correctly

See original GitHub issue

Describe the bug

When I follow CONTRIBUTING.md to open the .sln in VS, I get the following error:

image

…followed by the following solution window:

image

The contents of the Solution output window are as follows:

C:\code\git\tye\src\tye\tye.csproj : error  : The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

C:\code\git\tye\test\E2ETest\Microsoft.Tye.E2ETests.csproj : error  : The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

C:\code\git\tye\src\Microsoft.Tye.Hosting\Microsoft.Tye.Hosting.csproj : error  : The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

C:\code\git\tye\src\Microsoft.Tye.Hosting.Diagnostics\Microsoft.Tye.Hosting.Diagnostics.csproj : error  : The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

C:\code\git\tye\src\Microsoft.Tye.Hosting.Runtime\Microsoft.Tye.Hosting.Runtime.csproj : error  : The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

C:\code\git\tye\src\Microsoft.Tye.Core\Microsoft.Tye.Core.csproj : error  : The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

C:\code\git\tye\test\UnitTests\Microsoft.Tye.UnitTests.csproj : error  : The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

C:\code\git\tye\src\Microsoft.Tye.Extensions\Microsoft.Tye.Extensions.csproj : error  : The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

C:\code\git\tye\src\Microsoft.Tye.Extensions.Configuration\Microsoft.Tye.Extensions.Configuration.csproj : error  : The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

C:\code\git\tye\src\Microsoft.Tye.Proxy\Microsoft.Tye.Proxy.csproj : error  : The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

C:\code\git\tye\test\Microsoft.Tye.Extensions.Configuration.Tests\Microsoft.Tye.Extensions.Configuration.Tests.csproj : error  : The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

C:\code\git\tye\test\Test.Infrastructure\Test.Infrastructure.csproj : error  : The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

C:\code\git\tye\src\tye-diag-agent\tye-diag-agent.csproj : error  : The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

To Reproduce

Initially, when I took those screenshots, I was running build.cmd and startvs.cmd in a non-administrator PS terminal.

As I’m documenting this, I tried it in an admin PS window and I got different (but not great) results. When run build.cmd, it seems to start off fine:

image

…but it ends badly:

image

Further technical details

  • Include the output of tye --version
PS C:\code\git\tye> tye --version
0.8.0-alpha.21352.1+fc0ab39f1bd2f1cd4d5b5c0a07f66f61a44263ea
  • If possible rerun the command with -v debug and include the output
  • The platform (Linux/macOS/Windows) Windows 10 (up to date)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
philliphoffcommented, Oct 19, 2021

@ignacioerrico On a newly-minted VM, I wasn’t able to reproduce the command line build error, but I was able to reproduce the VS 2019 solution load/build issue, which allowPrerelease resolves, so thanks for that.

0reactions
ignacioerricocommented, Oct 16, 2021

Same thing here.

The issue occurs if you use a non-preview version of Visual Studio, like the one in the screenshot shared by @alexdresko. (To work with Blazor, at least VS 2019 v16.6 is required, so that’s probably the lowest non-preview version that is possible to use.)

By default, VS 2019 has the option Use previews of the .NET Core SDK unchecked, so the SDK resolver will ignore the prerelease version 6.0.100-preview.6.21355.2 installed by the script build.cmd, and that’s the only version meant to be used.

I suggest allowPrerelease be set to true for the sdk object in global.jsonreference. This will only take effect when working with the Tye solution. The setting is ignored if you use a preview version of Visual Studio, so it makes sense to have it.

Since it’s a minor change, I’ll go ahead and raise a PR for that.

NB. An alternative would be to manually check the option to Use previews of the .NET Core SDK in Visual Studio (Tools > Options > Environment > Preview Features), but that would affect all solutions you work with, not just Tye.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio 2022 Community Project not load solution
Right-click the . sln file and choose Open With , select Visual Studio 2022 Community, and check if the project can be successfully...
Read more >
"Error: One or more projects in the solution were not loaded ...
open your Visual Studio and select Open a project or solution ... After loading the project successfully, to solve the .sln file issue....
Read more >
startvs.cmd loads the solution in VS2017 not VS2019 #7824
sln solution is now opening up correctly in Visual Studio 2019 by either method; startvs.cmd or by manually double-clicking on the Components.
Read more >
Service Fabric Project not loading - Developer Community
Run the following command: devenv /UpdateConfiguration. Re-start VS 2019 and the Service Fabric extension should be working again.
Read more >
One or More Projects in the solution were not loaded correctly
If you want to fix this types of error then must to update your tools, I face this problem when I was not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found