KirillOsenkov / MSBuildStructuredLog

A logger for MSBuild that records a structured representation of executed targets, tasks, property and item values.
MIT License
1.44k stars 190 forks source link

Improve launching the TaskRunner #548

Closed 0xced closed 2 years ago

0xced commented 2 years ago

Launch the TaskRunner as .NETFramework (TaskRunner.exe) or .NETCoreApp (dotnet TaskRunner.dll) depending on the task dll target framework identifier.

Fixes #403 Fixes #539

Note that unlike what was hinted in #403, the TaskRunner.runtimeconfig.json file is generated at build time and RollForward has been set to LatestMajor so that the TaskRunner.dll can run on any installed .NET (Core) runtime. Because "make sure the framework exists from step 2" might turn into a pretty expensive operation.

0xced commented 2 years ago

Note that this pull request is not a 100% working solution because both TaskRunner.exe and TaskRunner.dll should be copied into the same output directory for StructuredLogViewer.exe to choose at runtime. Currently, TaskRunner.exe is copied into bin\StructuredLogViewer\Debug\net472 and TaskRunner.dll is copied into bin\StructuredLogViewer\Debug\net5.0-windows.

Since I'm not familiar with how the final application is packaged, I prefer to let you think about the best solution on how to package both TaskRunner executables.

KirillOsenkov commented 2 years ago

Thanks, I'll try to find time to get it all ironed out soon.

KirillOsenkov commented 2 years ago

How's this?

https://github.com/KirillOsenkov/MSBuildStructuredLog/commit/5757c77e14b727d4f0d73de07d93bbfc54d9d678

KirillOsenkov commented 2 years ago

If you could try it when you have time and let me know if any other .dlls are missing.

KirillOsenkov commented 2 years ago

Hmm I suppose a better solution would be to copy TaskRunner.dll to the same output directory during the build so that F5 works.

KirillOsenkov commented 2 years ago

@0xced hopefully this is better: https://github.com/KirillOsenkov/MSBuildStructuredLog/commit/e8373fe4dcc86b18f8b22b9c6b5b28aecbacff8b