dotnet / dotnet/msbuild

Provide a clearer error if a .NET Task assembly uses a .NET Runtime that is unsupported by the .NET Runtime of the .NET TaskHost Node

Open
#12,913 0 comments 0 reactions 0 assignees View on GitHub
Area: TaskHost backlog triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Summary

When loading .NET Tasks on an out of proc .NET TaskHost Node, we locate the MSbuild from the current SDK and have that Node load and execute a Task in the assembly. If there is a runtime mismatch between that host node and the Task dll, the user will see a loading error - we should make sure that this error is very clear - the load error comes because the Task author tried to load the dll on a runtime that the Task _user_ didn't have.

This is something that I expect will become more important in the version of .NET _after_ we launch multithreading. The mismatch is:
* Task is authored for .NET 12 Runtime
* Task is run on .NET 11 Runtime
* Task fails at runtime

### Background and Motivation

See above

### Proposed Feature

When launching the taskhost node, we should be able to
* know what the SDK version (and therefore the .NET Runtime the MSBuild binary would use) of the TaskHost is
* probe the assembly to be loaded to find its Runtime version (based on assembly attributes and/or runtimeconfig.json parsing)
* error if the discovered runtime version isn't supported by the runtime of the SDK

### Alternative Designs

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.