-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
MSBuild Generally Inconsistent/Buggy Behavior #3366
Comments
Did you try using Also, I've been using custom targets with msbuild for some time and I've never hit big inconsistencies between VS, the MSBuild CLI and the .NET CLI. Do you have some concrete examples for those differences? |
Thanks for the reply. To your first question - no, no tests are found even when doing dotnet vstest - I assume it might be because the PowerShell Tools TestAdapter is compiled for the NETFramework version of MSBuild (task assemblies are not cross compatible)....but I can’t be sure. Regarding inconsistencies - the biggest is around what targets get called for sln package restores
Essentially I have two goals here:
|
AFAIK, the common targets are the same for all environments. The main difference is that on VS it loads design time targets, which include some targets used at design time to resolve references, as well as project capability includes used by the project system.
|
That link is actually great - the interop APIs explain why Restore isn’t called. But the problem is that you literally can’t call the Restore target yourself if an sln Restore is performed by VS or the dotnet CLI (AFAIK)...or at least you can’t without a ton of hacking around stuff (which introduces even more variability between CLI vs VS |
Also - dotnet vstest doesn't work at all ...seems like another known bug that's marked as resolved...but not actually I'm running I get
I am, of course, referencing that package |
And
doesn't error out but still doesn't find my tests
VS Test Explorer also fails to load the tests...but with yet another different error This is what I mean by inconsistent/buggy - different behavior (all non-functional) depending on where you're running from. It's truly horrific. |
I can only agree and add: I understand why these issues exist & i'm not trying to pile on, It just begs the question as to where the responsibilities actually reside? Why does the nuget cli have a /build flag? Why is VSTest built into dotnet to achieve dotnet test but not built into msbuild the same as dotnet restore is built into the dotnet cli but also msbuild /t:Restore ? Where is the single source of truth? Why is dotnet adhering to a "global.json" file for SDK nuget resolution, while nuget is about to introduce a repo-wide packages.json? I am sorry, but this whole thing is starting to get out of hand. I am maintaining about 1000 csprojs at work desperately trying to distribute this responsibility, but i just keep being thrown back by stuff like this. |
We are trying to leverage MSBuild 15 for our build system and have just hit bug after bug due to inconsistencies in the overall MSBuild implementation. It’s always been the case that it’s tricky dealing with differences between how devenv and command line MSBuilds work. In MSBuild 15 and with dotnet core MSBuild, it’s gotten so bad that we have ended up needing to write unit tests just to verify all the different build variations actually work. There are builds via
Each one of the above behaves differently...in some cases, massively differently.
Then the above list gets multiplied by 2 because sln file builds behave totally different from (cs)proj file builds.
What I’d like to know is - which of the above build scenarios/models should we be designing for to get the best level of support and stability going forward? It’s borderline impossible to support them all.
Our basic desire is to have a build script that runs
dotnet pack my.sln -o artifacts
A test script that runs
dotnet test my.sln -a ...
And have Visual Studio builds work as well
Calling msbuild.exe would be equally okay vs. dotnet.exe if it actually worked.
It sounds easy but it’s so far from it....
With a simple solution consisting of:
Basically, what we’ve found
dotnet restore, msbuild /t:Restore and Visual Studio produce different assets files causing unnecessarily design-time builds NuGet/Home#4627
Then there is the issue with calling pack on the sln when a csproj in it has GeneratePackageOnBuild set to true.
Then there is the issue that vstest via dotnet test doesn’t find PowerShell tests (only vstest.exe does)...but calling msbuild.exe /t:vstest doesn’t seem to be supported.
What’s a good strategy here?
The text was updated successfully, but these errors were encountered: