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
different behavior of VS 2019 build and dotnet msbuild #15654
Comments
|
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
|
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
|
VS build and dotnet msbuild behavior will not always match exactly, so it sounds like this is expected. It looks like VS detects that no files have been changed and does not run the build the second time (meaning it skips the post build event too). Since that logic does not exist on the command line, when you run 'dotnet msbuild' or 'dotnet build' the build and the post build event are both rerun the second time. Is there a specific difference here that you think might be a bug or are we okay to close this? |
|
Hi @sfoslund, thanks for your reply. It looks like dotnet cannot deal with incremental builds. I am using the postbuild event in this example only to showcase that the incremental build does not seem to work. I am migrating a bigger non-sdk style project that was built with VS 2019 to the net sdk-style projects and dotnet. I expect that I can end up with a build flow similar to my old (VS 2019) feature wise. One important aspect of a build system for me is incremental building and being able to hook into build events. Imagine I want to recompile an assembly every time the git revision has changed (using e.g. gitversion) or I want to generate a set of files every time a dependent project has changed (executing "$(TargetPath)" in the post-build event). It does not make sense to execute these tasks when the dependencies did not change. This does work fine with VS 2019, thats why I assumed it should also work with dotnet. |
Description
From what I understand
dotnet msbuildshall behave identical to building with Visual Studio (I have not read that anywhere and such my premises might be wrong).My expectation is the behavior of Visual Studio: That the PostBuildEvent is not called if the output is not updated.
When I compile my sample from Visual Studio 2019 16.8.4 this is the output
The second run then yields:
When I compile it using
dotnet buildThe second run then yields:
When I compile it using
dotnet msbuildThe second run then yields:
So what we can observe here is that dotnet build and dotnet msbuild both call the PostBuildEvent even when the output was not updated but Visual Studio does that only when the output was updated.
Configuration
Additional Information
I have added the minimal sample msbuildTest.zip I have been using for the results given above.
The text was updated successfully, but these errors were encountered: