Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I specify path of msbuild when running "dotnet msbuild" command?

I want to run "dotnet msbuild" command: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-msbuild

However, I want to be able to specify the exact path to msbuild like: dotnet C:\name\msbuild.exe. (Adding it to the path is not an option)

How can I do this?

like image 346
joe Avatar asked Dec 13 '25 14:12

joe


1 Answers

However, I want to be able to specify the exact path to msbuild like: dotnet C:\name\msbuild.exe. (Adding it to the path is not an option)

Actually, dotnet msbuild does not have an option to specify which version of MSBuild to use. And MSBuild of dotnet.exe is updated with the Version of the NET Core SDK.

And as far as I know, the latest Net Core 3.+ SDK uses MSBuild 16.+ which is the latest MSBuild. So if you want to use the latest MSBuild on your windows server container, you should install the latest version of Net Core.

Note: In this way, you can only use MSBuild 16.+which supports building the old projects.

Besides, you can also install Build Tool for VS2019 or Build Tool for VS2017 to build your projects on your windows server container. Please refer to this link.

It is a lightweight build command-line tool that can be thrown away from the vs installation. When you start to install it, you need to select the related Build workload.

Build Tool for VS2017 is MSBuild 15 while Build Tool for VS2019 is MSBuild 16. You can install both of them.

Then after you finish installing it, you should launch Build Tool and then you can build them with command line msbuild xxx.xxproj -t:target.

like image 87
Mr Qian Avatar answered Dec 16 '25 04:12

Mr Qian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!