Jetbrains Cleanup Code
Hi guys,
I am trying to integrate a git hook with Jetbrains Cleanup Code, but I am facing this error.
JetBrains Cleanup Code 2024.3.5
Running on x64 OS in x64 architecture, .NET 9.0.2 under Microsoft Windows 10.0.26100
The SDK 'Microsoft.NET.SDK.WorkloadAutoImportPropsLocator' specified could not be found. C:\Program Files\dotnet\sdk\8.0.406\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.props at (14:38)
The SDK 'Microsoft.NET.SDK.WorkloadAutoImportPropsLocator' specified could not be found. C:\Program Files\dotnet\sdk\8.0.406\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.props at (14:38)
The SDK 'Microsoft.NET.SDK.WorkloadAutoImportPropsLocator' specified could not be found. C:\Program Files\dotnet\sdk\8.0.406\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.props at (14:38)I'm on windows with dotnet 8 and 9 skds installed and in the target solution i need dotnet 8 (setted up via global.json)
The thing I noticed from the log is that from the header it shows dotnet 9 while in the exception the paths refer to dotnet 8 sdk.
Has anyone had similar error ? any advice ?
Update:
Same issue with the same dotnet version. Trying to set dotnet 9 at global.json a similar error occurs:
JetBrains Cleanup Code 2024.3.5
Running on x64 OS in x64 architecture, .NET 9.0.2 under Microsoft Windows 10.0.26100
The SDK 'Microsoft.NET.SDK.WorkloadAutoImportPropsLocator' specified could not be found. C:\Program Files\dotnet\sdk\9.0.200\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.props at (14:38)
Please sign in to leave a comment.
Already tried:
dotnet workload restorewhich still fail$env:MSBuildEnableWorkloadResolver = 'false'that does not cause the errorBut the env var is not an option because is needed for other purposes.
Hello Claudio,
Thank you for contacting Rider support.
I looked into this and see that normally the cleanupcode.exe runs under .Net Framework. The way to launch it under .Net installed on machine (or .Net specified on global.json) is to pass cleanupcode.exe as an argument for dotnet command.
So, I suppose you use CLI
dotnet <pathToRSCmdTools>/cleanupcode.exe <pathtoSlnOrCsproj>. Would you mind trying to use<pathToRSCmdTools>/cleanupcode.exe <pathtoSlnOrCsproj>instead to see if that helps?Have a nice day!
Actually at the moment I followed the guide by installing it as a dotnet tool.
So I did
dotnet tool install JetBrains.ReSharper.GlobalToolswhose references are saved in the./.config/dotnet-tools.jsonfile.I am running the command like this
Where staged are all the file path separated by
;char.—
Regarding your suggestion, the error is identical although it actually changes something in the header.
%USERPROFILE%\.dotnet\toolResolverCache\1%NUGET_PACKAGES%\jetbrains.resharper.globaltools\2024.3.5\tools\netcoreapp3.1\anyThis is the output
assuming that working directory is:
D:\git\myprojectglobal.json
dotnet --info
Hello Claudio,
Unfortunately, it is hard to day what exactly goes wrong. Would you mind sharing more details and commenting on my questions/suggestions below?
What about
dotnet workload restore? Does it succeeds when invoked from the terminal (with "cd D:\git\myproject")?And what about this variable
$env:MSBuildEnableWorkloadResolver = 'false'. Do you mean the cleanupcode finishes fine whenMSBuildEnableWorkloadResolver=true?First, I would try specifying exact sdk from global.json to avoid ambiguity: (or temporary remove the global.json file)
Second, I suggest ensuring the whole “.Net desktop development” and “ASP.NET and web development” workloads are installed in VS installer;
Third, try building your solution using the same MSBuild utilized by cleanup tool:
& "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe" "C:\PathTo\Your\Solution.sln"Fourth, try uninstalling both existing .Net 9 installations, so that only .Net 8 remain available. If still issue persists, try reinstalling .Net 8 using installer from .Net downloads page.
Additionally, would you mind checking if invoking cleanup tool from Rider-bundled terminal prints the same error? And does the issue persists for a newly created solution? (or the issue reproduces only with exact solution)
If nothing helps or you do not wish reinstalling .Net, I would appreciate it if you could share a log file for the cleanupcode tool:
dotnet jb cleanupcode .\AspireTest.sln --verposity=TRACE > output.txtPlease attach the log to the Upload Service and let me know the Upload ID.
Have a nice day!