- Notifications
You must be signed in to change notification settings - Fork1.4k
Debugging MSBuild - setup difficulties#10683
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I'm having difficulties setuping my environment in order to launch a simple msbuild run in the debugger. 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): { } 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. |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 3 comments 20 replies
-
It sounds like you want to debug msbuild.exe. If so, you can refer towalkthroughs. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
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. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Besides MSBuild binaries, to get msbuild.exe work also needs additional dependencies (Roslyn compilers, NuGet, etc.) as the beginning of the walkthrough introduces the "bootstrap" directory. The MSBuild solution at the repository root couldn't work by itself. And the wiki introduces debugging MSBuild by attaching the debugger through setting the environment variable |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Thank you, I had not understood that I couldn't just launch the debugger in VS pressing F5, targeting the msbuild project. I needed to run the executable in command line and then attach the debugger. You made that clear to me, thank you. I have made some progress, I can attach VS now. However, I'm unable to successfully build any solution. I tried different solution, and this is the error I get with a very simple one : & ".\artifacts\bin\bootstrap\net472\MSBuild\Current\Bin\MSBuild.exe" "C:.........sln" Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Of course, this solution does build if I do it from visual studio. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I don't hit this error. What's the Visual Studio version you use? It's probably not compatible with the latest code in main branch of MSBuild. The "bootstrap" directory acquires the additional dependencies from local installed Visual Studio. |
BetaWas this translation helpful?Give feedback.
All reactions
-
The latest version, 17.11.4. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I did not mentionned it, but my goal is to modify msbuild.exe in order to removeall the warning it emits, since its not possible to do that with configs/arguments. |
BetaWas this translation helpful?Give feedback.
All reactions
-
the -nowarn switch seems to work. So I will have to retry the response file solution |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I tried it in the props file, and it does not work. I still see the MSB3277/CS0162 warnings when I build in Visual studio. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Do you set a NoWarn property in the project too? If you do, it'll override what's in Directory.Build.props, unless it explicitly appends, e.g. <PropertyGroup> <NoWarn>$(NoWarn);CS1591</NoWarn></PropertyGroup> |
BetaWas this translation helpful?Give feedback.
All reactions
-
I removed it from the csproj, but I still see the warnings. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Worth mentionning , I just tried the /clp:ErrorsOnly switch, which could sometimes be pleasant. But with it the build time goes from 74 seconds to 155 seconds. Which makes no sense to me . |
BetaWas this translation helpful?Give feedback.
All reactions
👀 1