Can TeamCity use x64 MSBUILD for .net runner

Our product is built with x64 and we decided to use vs2022 for our development.

We can't select the latest msbuild tool(2022) inside MSBUILD runner which is deprecated, so I want to switch to use .net runner.

However MSBUILD tool in .net runner uses x86 as described in .NET | TeamCity On-Premises (jetbrains.com) and it states that

  • The .NET runner uses x86 run platform by default. If the x86 version is not available, it will use x64.

I renamed the x86 msbuild but then TC(2021.2.2 (build 99660)) encounters error below

  • Cannot run process (file not found): C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe

I tried on my local that it will hit errors with x86 msbuild for the deployment but it's working fine with x64 msbuild.

So any suggestions to enforce using the x64 msbuild in .net runner or any workaround on this? Thanks.

1
3 comments

Hello,

Are you setting the target runtime with the appropriate .Net Runtime identifier in your .net runner options, or your doubt is actually about enforcing the use of a specific msbuild? In that case, you can try to specify the path to the desired msbuild using build parameters. You could check under your agent details the x86 which paths you would like to replace (as an example, MSBuildToolsXX.0_x86_Path), and force the use of specific agents that match these parameters in your build configuration via a condition in the agent requirements. 

Please let me know if this works for you or if you have any doubts.

Thank you,

Guilherme

0

Thanks for your reply, Guilherme.

Are you setting the target runtime with the appropriate .Net Runtime identifier in your .net runner options

Yes, I tried that but it didn't work for me.

So I used Command Line with x64 MSBUILD parameter as you suggested instead of .net runner for the deployment as a workaround.

0

Hello,

we are currently using the same workaround to build our (rather big) solution, which is developed with VS 2022. Unfortunately we encountered memory problems back in the days with the x86 version of MSBuild, causing our builds to fail. Since using the above proposed workaround to call the x64 variant of MSBuild via CLI, everything works fine, besides one drawback: The log output is masked in case of errors.

Example with .NET build step with command build:

Example with CLI build step with a call to msbuild (x64):

When a user clicks the failed build in the first image, TeamCity jumps to the correct line in the log output which shows the actual error. If a user clicks on the failed build in the second image, the end of the build log is shown where the MSBuild process actually failed, but not to the root cause of the failure (the compile error).

Is there a solution or workaround for this available? Or will it be possible in the future to select the MSBuild version (x86/x64) directly in the .NET build step, which might circumvent this behavior?

Thanks and best regards
Lars
 

0

Please sign in to leave a comment.