Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference from 'dotnet build' #6295

Closed
AndreiRinea opened this issue Jul 3, 2018 — with docs.microsoft.com · 10 comments · Fixed by #16735
Closed

Difference from 'dotnet build' #6295

AndreiRinea opened this issue Jul 3, 2018 — with docs.microsoft.com · 10 comments · Fixed by #16735
Labels
doc-enhancement Improve the current content [org][type][category]

Comments

Copy link

When should we use 'dotnet msbuild' as opposed to 'dotnet build'?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@solidcloudio
Copy link

solidcloudio commented Jul 6, 2018

I ran into an issue where a build dependency loaded a Custom Assembly with a Custom Build Task in a .dll This .dll depended on .net 4.0. Using "dotnet build" the build would fail to load System 4.0.0.

Using msbuild works, so I'd assume dotnet msbuild would work the same as MsBuild.

dotnet/standard#328
Azure/azure-functions-vs-build-sdk#160

Seems the MSBuild version used by dotnet build is "lightweight" or "scaled back" as it can't load external assemblies..

To Clarify - Cant load external assemblies that have a dependency on .net 4.x

Copy link

It is not clear whether "dotnet.exe msbuild" restores (downloads) dependencies like "dotnet.exe build" does?

@mairaw
Copy link
Contributor

mairaw commented Nov 13, 2018

@livarcocc @KathleenDollard @dsplaisted what can we add to the dotnet msbuild topic to make it more clear the distinction between dotnet build and dotnet msbuild? My understanding is that dotnet msbuild gives you the same capabilities as MSBuild, but you can also pass MSBuild parameters to dotnet build as well, right? I think the topic would benefit from having more information about the difference between the two commands.

@dsplaisted
Copy link
Member

dotnet build is basically the same as dotnet msbuild -restore -target:Build.

@verbaloid
Copy link

then what do both of them exist for?

@dsplaisted
Copy link
Member

@verbaloid Most of the time if you want to build your project you want to run dotnet build. If you have a specific target you want to run (without running the build target), you probably want to use dotnet msbuild. Basically dotnet build is the common case, but dotnet msbuild gives you more control.

@verbaloid
Copy link

thank you - now it is much more clear - can someone also update both microsoft dotnet build and msbuild pages by this guidance

@mairaw
Copy link
Contributor

mairaw commented Dec 4, 2018

one more question re. this @dsplaisted. Given that you can also pass MSBuild options to the dotnet build command, I assume you could achieve the same results with dotnet build as well, correct?

also, can you give an example of how the command would look like for this scenario you described? "if you have a specific target you want to run (without running the build target)"

@dsplaisted
Copy link
Member

dotnet build will always run the Build target.

So if you want to only run the MyTarget target, you should do dotnet msbuild -target:MyTarget. You could also do dotnet build -target:MyTarget, but that would then run both MyTarget and the Build target.

@mairaw
Copy link
Contributor

mairaw commented Dec 4, 2018

Gotcha! Thanks @dsplaisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-enhancement Improve the current content [org][type][category]
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants