Skip to content

GenerateSupportedRuntimes causes breaking change with targeting specific .NET framework versions #3036

@ChrisMaddock

Description

@ChrisMaddock

(I think that...) The new GenerateSupportedRuntimes functionality (#2447) caused a breaking change, when using the complus_version environment variable, to launch a process running on a specific version of the .NET Framework. This change broke the NUnit Console, which relies on this behaviour. The solution to this may be to "not do that" - but I thought I should report for awareness.


The NUnit Console by default runs all test assemblies in external processes (called "agent processes"), and uses the complus_version environment to run these agent processes on a specific version of the .NET Framework. (The target version of the test assembly in question.)

For complus_version to be respected, it's required that no supportedRuntime elements exist in the app.config. Otherwise, these elements appear to override complus_version. Because the agent executable currently targets .NET 2.0 (as the lowest runtime we support), the new GenerateSupportedRuntimes functionality added <supportedRuntime version="v2.0.50727" /> to the app.config, forcing the agent processes to always run on .NET 2.0, and therefore fail to load any assemblies targetting .NET 4.0 or higher.

Because we potentially need to launch multiple agent processes under various different frameworks at runtime, having fixed values in the app.config is not an option. We've currently added <GenerateSupportedRuntimes>false</GenerateSupportedRuntimes> to our csproj's to suppress this behaviour.

I'm aware complus_version isn't 'documented'...is there a better solution we should be using to support this situation instead?

Apologies if I've incorrectly pinpointed the cause here - I'm not too familiar with MSBuild.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions