sdk: Current 6.0 SDK building in VS errors with 'Microsoft.NET.SDK.WorkloadAutoImportPropsLocator' specified could not be found.
In VS building a mostly empty web project fails with
1>------ Rebuild All started: Project: WebApplication1, Configuration: Release Any CPU ------
1>C:\Program Files\dotnet\sdk\6.0.100-preview.5.21255.14\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.props(14,3):
error : C:\Program Files\dotnet\sdk\6.0.100-preview.5.21255.14\Sdks\Microsoft.NET.SDK.WorkloadAutoImportPropsLocator\Sdk not found.
Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.
1>C:\Program Files\dotnet\sdk\6.0.100-preview.5.21255.14\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.props(14,38):
error MSB4236: The SDK 'Microsoft.NET.SDK.WorkloadAutoImportPropsLocator' specified could not be found.
1>Done building project "WebApplication1.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
At CLI it suceeds by has a different warning (which is https://github.com/dotnet/sdk/issues/17388)
Microsoft (R) Build Engine version 16.11.0-preview-21254-21+e73d08c28 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
Restored C:\Users\thund\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj (in 62 ms).
You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
C:\Program Files\dotnet\sdk\6.0.100-preview.5.21255.14\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(255,5):
warning NETSDK1048: 'AdditionalProbingPaths' were specified for GenerateRuntimeConfigurationFiles,
but are being skipped because 'RuntimeConfigDevPath' is empty.
[C:\Users\thund\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj]
WebApplication1 -> C:\Users\thund\source\repos\WebApplication1\WebApplication1\bin\Debug\net6.0\win-x64\WebApplication1.dll
Build succeeded.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 81 (37 by maintainers)
Commits related to this issue
- Set MSBuildEnableWorkloadResolver to work around https://github.com/dotnet/sdk/issues/17461 — committed to NuGet/NuGet.Client by debonte 3 years ago
- Add workaround for https://github.com/dotnet/sdk/issues/17461 — committed to andrewlock/StronglyTypedId by andrewlock 3 years ago
- Add workaround for https://github.com/dotnet/sdk/issues/17461 — committed to ProActive-Engineer/StronglyID by deleted user 3 years ago
- Add workaround for https://github.com/dotnet/sdk/issues/17461 — committed to ProActive-Engineer/StronglyID by ProActive-Engineer 3 years ago
CORECTION
I am finally able to get VS2022 for Mac (v17.0 - build 8989) working by setting the
MSBuildEnableWorkloadResolver = falseenvironment variable.For those who have the same issue: Note that the most systemic way to set environment variables in MacOS is through
launchctl:The old approach of systemically setting environmental variables was via
~/.MacOSX/environment.plist. However, that approach was removed in OS X Lion.If you turn on Diagnostic log verbosity, the first thing listed in the build log will be the environment variables used for the build. Setting environment variables in the traditional Unix way (
.profile,.bash_profile,.zprofile,.zshenv, etc) will not work for applications.TO THE MAINTAINERS
I still ask that you consider reopening this issue. Several times it is stated that setting the
MSBuildEnableWorkloadResolverenvironment variable is not necessary with more recent releases of VS2022. My experience has proven that this is not universally true.Thank you @baskren !
‘’’ launchctl setenv MSBuildEnableWorkloadResolver false ‘’’
finally brought back my rider ide
I’m having this same issue on macOS, either on Rider or running
dotnet buildfrom the command line. .NET 6 was working a few days ago when I was using the nightly releases, stopped working when I installed Preview 4.Tried the workaround, setting
MSBuildEnableWorkloadResolverenv variable to false seems to work. I was able to load and build the project now.I just had this issue with Visual Studio for Mac 17.3.8 (build 5). This issue is clearly not fixed and should be reopened.
Just had this issue on VS 17.3.6 (build 20) on macOS Monterey 12.6
Wasted days before finding this “launchctl setenv MSBuildEnableWorkloadResolver false”
The issue started after installing latest Xamarin.iOS.
Seems like a lot of regression testing is left with the community.
This is still happening for me as well.
<Project Sdk="Microsoft.NET.Sdk"><TargetFrameworks>net6.0</TargetFrameworks>MSBuildEnableWorkloadResolveris so I assume it’s not set.This is still an issue on the release version, even on Azure pipelines.
see this build for example: https://dev.azure.com/AvaloniaUI/AvaloniaUI/_build/results?buildId=16510&view=logs&j=0da5d1d9-276d-5173-c4c4-9d4d4ed14fdb&t=5494183b-801e-5084-3b4b-5451c6a14ee1
Closing this issue out with the release of RC2 which we believe should fix most instances of this. Folks still seeing issues should try to clean out their sdks (in particular old sdk-manifests) and reinstall as many people still hitting this had leftover files from old maui-check calls. I think dotMorten’s repro is a completely separate issue than this.
For folks seeing this error, here’s a summary/overview.
The error
The SDK 'Microsoft.NET.SDK.WorkloadAutoImportPropsLocator' specified could not be foundcan be caused by several underlying issues.It may indicate that the .NET workload resolver is not present in the MSBuild directory. This happens with versions of Visual Studio that do not support the .NET 6 previews. (It could also happen in corrupt MSBuild installations or custom MSBuild distributions, but that’s an edge case.)
Otherwise, it indicates an internal error in the workload resolver, most likely when reading the workload manifests in the .NET SDK. A known case is a composition error due to stale manifests from an older .NET 6 preview, which can be fixed by removing the
dotnet/sdk-manifests/6.0.100directory from the .NET installation and reinstalling the latest .NET 6 SDK preview. If that doesn’t fix it, check the MSBuild log for details of the internal error. It will be surfaced better in future.if you can’t find get to an MSBuild log in the IDE, you can invoke msbuild from the CLI. Be aware that Visual Studio includes its own copy of MSBuild, which can be invoked as follows:
msbuildfrom that prompt.vsmac msbuildfrom Terminal.app. If you have multiple VS instances, seevsmac --helpfor arguments to select a specific instance.I just set the
MSBuildEnableWorkloadResolverenvironment variable on all my machines tofalse. Looking forward to what breaks in future when I forget I’ve done that 😀@hellfirehd please read #22221 (or better visit official Nuke community in Slack to get support there)
@sfoslund for visibility as we tried to put a hack into the resolver to avoid this particular rename but it looks like that may have only applied to VS. Workloads were designed to be SxS across different feature bands but not within the same one which previews are.
Thanks! That worked.
Can the SDK make this feature opt-in, rather than opt-out, until it’s ready enough to work without such mitigations?
NuGet has a bunch of functional tests that restore various projects, and it’s a bit of a burden to find all the places we need to set this. Plus we’ll need to remember to remove it again in the future.
Actually, a better workaround is probably to set
MSBuildEnableWorkloadResolverto false. This should avoid the issue with the manifest schema change.Of course, eventually after you are using an updated version of VS you’ll want to unset the environment variable to allow workloads to work.
The .NET 6 SDK now enables workload resolvers by default. This means when using Full Framework MSBuild (which happens in Visual Studio or when you use
msbuildinstead ofdotnetfrom the command line), you need the workload resolver enabled. This is enabled by default in VS 16.10 Preview 3. For previous versions of MSBuild, you can set theMSBuildEnableWorkloadResolverenvironment variable totrue. However, this workaround is likely to stop working in Preview 4 or Preview 5 of .NET SDK 6.0.100, as there is a change to the workload manifest schema which will cause the previous version of the resolver to fail.In short: Update to VS 16.10 Preview 3 or later if you can, and if you can’t you can try setting the
MSBuildEnableWorkloadResolverenvironment variable totrue.The ‘Microsoft.NET.SDK.WorkloadAutoImportPropsLocator’ not being found error can happen in VS Mac for different reasons. There is a recent feedback ticket where if there were old pre-release versions of .NET 7 installed then this could also happen:
https://developercommunity.visualstudio.com/t/After-updating-to-net-7-Visual-Studio-/10194756
The underlying bug, old workload was renamed in later .NET 7 SDK, was also reported for Windows - https://github.com/dotnet/sdk/issues/28947
The workaround there is to remove .NET completely and install it again. The developer community ticket gives information on how to do that.
If that does not solve the problem, then we would need the IDE log. Since the IDE log may contain personal data it would better if this was reported on Developer Community or via Report a Problem from with VS Mac itself. Thanks.
That is because monodevelop is not supported anymore I think at all.
I am also having this issue. Attempting to run my project (https://github.com/ppy/osu) in monodevelop gives me:
/usr/share/dotnet/sdk/6.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.props(38,38): Error MSB4236: The SDK 'Microsoft.NET.SDK.WorkloadAutoImportPropsLocator' specified could not be found. (MSB4236) (osu.Game)But if I run it in CLI (dotnet run --project osu.Desktop) it runs just fine. I am not sure if this is an issue relating to dotnet or monodevelop, but I read here that this is apparently an issue with dotnet, so I figured putting it here.Causes all VS builds to fail including net5.0 ones.
Adding
global.jsondoes allow them to build