Debugging MSBuild - setup difficulties #10683
Replies: 3 comments 20 replies
-
It sounds like you want to debug msbuild.exe. If so, you can refer to walkthroughs. |
Beta Was this translation helpful? Give feedback.
-
Thank you. Running the build.cmd produced the artifact folder with the msbuild in it (artifacts\bin\bootstrap\net472\MSBuild\Current\Bin\MSBuild.exe), however when I launch the debugger with the project msbuild as startup project, I get the following errors : error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found. This is why yesterday I was trying to set some environment variable to help it find the sdk, but I find it weird that this would not be mentionned in the wiki. I also noticed that when I launch the debugger, the .exe that is launched is not the one in the "Current" folder (artifacts\bin\bootstrap\net472\MSBuild\Current\Bin\MSBuild.exe). Which would explain the error I had in the first place, but I don't know how to make sense of it. |
Beta Was this translation helpful? Give feedback.
-
I did not mentionned it, but my goal is to modify msbuild.exe in order to remove all the warning it emits, since its not possible to do that with configs/arguments. |
Beta Was this translation helpful? Give feedback.
-
I'm having difficulties setuping my environment in order to launch a simple msbuild run in the debugger.
My understanging is that I have to set some environment variables in order to make it work since the msbuild.exe is not located in his usual location, among other things.
Here's where I'm at right now (the last exception I got), and below I pasted my launch configuration :
C:\Program Files\dotnet\sdk\9.0.100-rc.1.24452.12\sdks\Microsoft.NET.Sdk\Sdk\Sdk.props(49,11):
error MSB4226: The imp
orted project "C:\Users\admin\Documents....\msbuild-main\artifacts\bin\MSBuild\Debug\net472\Current\Microsoft.Commo
n.props" was not found. Also, tried to find "Current\Microsoft.Common.props" in the fallback search path(s) for $(MSBui
ldExtensionsPath) - "C:\Program Files (x86)\MSBuild" . These search paths are defined in "C:\Users\admin\Documents...\msbuild-main\artifacts\bin\MSBuild\Debug\net472\MSBuild.exe.Config".
{
"profiles": {
"MSBuild": {
"commandName": "Project",
"commandLineArgs": ""C:\..........sln"",
"environmentVariables": {
"MSBuildSDKsPath": "C:\Program Files\dotnet\sdk\9.0.100-rc.1.24452.12\sdks",
"DOTNET_ROOT": "C:\Program Files\dotnet",
"MSBuildExtensionsPath": "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current"
}
}
setting the MSBuildExtensionsPath does nothing in fact. MSBuildExtensionsPath ends up being the location of the msbuild.exe of my build (msbuild-main\artifacts\bin\MSBuild\Debug\net472). I'm not even sure it is necessary to try to set those variables.
Beta Was this translation helpful? Give feedback.
All reactions