msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

Distribute the MSBuild internal test helpers as a nuget package

Open MeikTranel opened this issue 5 years ago • 3 comments

Some of the APIs such as "TestEnvironment", the custom loggers and assertion wrappers could be really helpful for people who distribute Custom MSBuild Tasks / Sdks.

MeikTranel avatar Aug 01 '18 06:08 MeikTranel

I have created https://github.com/jeffkl/MSBuildProjectCreator as a test helper and its used in the MSBuildSdks repo:

https://github.com/Microsoft/MSBuildSdks/blob/master/src/CentralPackageVersions.UnitTests/CentralPackageVersionsTests.cs#L80

It does not do everything you mention but it does cover some of it.

jeffkl avatar Aug 01 '18 15:08 jeffkl

@jeffkl that does indeed help for some tasks and is definitely a good fit for a smaller projects who struggle with the most basic testing "infrastructure".

But at my workplace we're planning on investing in Custom SDKs and Task Packages on a much larger scale, where an official testing package build alongside the package we're testing would help greatly.

It's kind of an odd feature to have, but i have grown much more fond with the underlying idea since https://github.com/cake-build/cake 's test package. They serve the same basic need really. The application model is so odd/complex, that regular testing workflows and tooling is kinda all over the place for them.

The question to me would be: How much of an additional workload would it be for the product ownership of MSBuild to put this into the hands of some of the consumers. I'm sure the implementation of deployment wouldn't be an issue. Would you expect users of this package to use the package in a way that would drive the already implemented testing framework into places that it wouldn't naturally be (aka requiring APIs that serve no use the actual msbuild tests etc.)

MeikTranel avatar Aug 01 '18 20:08 MeikTranel

Would be lovely to do this - I replicated the helpers in https://github.com/dotnet/sdk/pull/26729 out of a desire to easily assert on logged messages.

baronfel avatar Jul 22 '22 20:07 baronfel

Hey @baronfel can you do some internal advertising for this to get some PM eyeballs on this?

Maybe we should wrap this in a larger vision and create an official MSBuild task package template - there seems to be much confusion about the entire system - which is why many people still use AfterBuild shell scripts seemingly confused that there even is something like a task that can act in a sane manner from within msbuild.

This discussion really shows this whole dilemma: https://github.com/dotnet/roslyn/issues/57608

Oh wait... you're PM :D:D

MeikTranel avatar May 22 '23 10:05 MeikTranel