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

Consider .NET Core TaskHost #4834

Open
rainersigwald opened this issue Oct 21, 2019 · 13 comments
Open

Consider .NET Core TaskHost #4834

rainersigwald opened this issue Oct 21, 2019 · 13 comments
Labels
Area: Engine Issues impacting the core execution of targets and tasks. Area: TaskHost Feature Request needs-design Requires discussion with the dev team before attempting a fix. .NET Core triaged
Milestone

Comments

@rainersigwald
Copy link
Member

Task declaration supports a Runtime attribute that allows MSBuild-running-on-.NET-4 to call tasks that support only .NET 3.5 (by spawning an MSBuildTaskHost.exe that runs on .NET 3.5 and communicates with the rest of the build via IPC).

Similar support could be used to support running .NET Core (or .NET Standard 2.1+) tasks from Visual Studio with Runtime="Core" (or something like that).

@teo-tsirpanis
Copy link
Contributor

A more immediate solution would be to allow Visual Studio to run the entire build on .NET Core.

That could be complemented by failing if .NET Framework-based MSBuild attempted to run a task marked with Runtime="Core".

@john-larson
Copy link

Is this on the roadmap?

@rainersigwald
Copy link
Member Author

@john-larson "yes" in the sense "we still think this is a good idea worth doing sometime hopefully soon", but "no" in the "we have a planned time to work on this".

@Denis535
Copy link

@rainersigwald, just wondering if there are any ways to run the code in a newer runtime? I am looking for workarounds.

@rainersigwald
Copy link
Member Author

@Denis535 the best option at the moment to run code during a .NET Framework/Visual Studio-driven build is to use an executable; then you can use anything that will run on the machine.

@Nirmal4G
Copy link
Contributor

Similar support could be used to support running .NET Core (or .NET Standard 2.1+) tasks from Visual Studio with Runtime="Core"

OR vice-versa, i.e. running full framework tasks from Core MSBuild via Runtime="CLR2/CLR4"

@rainersigwald
Copy link
Member Author

OR vice-versa, i.e. running full framework tasks from Core MSBuild via Runtime="CLR2/CLR4"

@Nirmal4G that's #711

@Nirmal4G
Copy link
Contributor

Yeah, it seems I'm the one marked the issue but forgot entirely. Silly me 😜🙃

@teo-tsirpanis
Copy link
Contributor

I am particularly interested in seeing this implemented. Is there a way for a community member to help?

@rainersigwald
Copy link
Member Author

@teo-tsirpanis Unfortunately, I think most of the work for this is

  • building consensus on direction with VS partners
  • deciding on some VS-specific implementation details
  • making VSIX authoring changes that can only be tested by triggering internal VS test builds

which makes it pretty hard to help externally.

Can you expand on your desire for the feature though? Having clear use cases can help us prioritize it internally.

@teo-tsirpanis
Copy link
Contributor

teo-tsirpanis commented Oct 25, 2022

I have an MSBuild task that runs after compilation and executes code from the compiled assembly using AssemblyLoadContext, necessiating targeting modern .NET. To support the .NET Framework edition of MSBuild Visual Studio runs I tried to do the same with AppDomains but gave up; I could not make it load the assembly's dependencies, and the complete object isolation of app domains would affect the structure of my code.

So what I did is run the task out-of-process on modern .NET when we build on .NET Framework, but this presents its own challenges. The out-of-process tool has to be installed separately (to avoid increasing package size for everyone), sending logging messages requires additional ceremony , and there are issues around targeting frameworks greater than the tool (the tool runs on .NET 6 and cannot load .NET 7 assemblies, while the in-process task runs on the same framework as the SDK and does not have this problem).

Implementing this would reduce complexity in my code and improve the user experience.

@Jinjinov
Copy link

Jinjinov commented Aug 3, 2023

Is this feature coming in .Net 8?

@baronfel
Copy link
Member

baronfel commented Aug 3, 2023

No, it's not planned for the .NET 8 GA release this fall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Engine Issues impacting the core execution of targets and tasks. Area: TaskHost Feature Request needs-design Requires discussion with the dev team before attempting a fix. .NET Core triaged
Projects
None yet
Development

No branches or pull requests

9 participants