Skip to content

Loading net5.0 Assemblies Shouldn't Happen When Running < net5.0 #92

@benvillalobos

Description

@benvillalobos

Related issue and repro: dotnet/msbuild#5600

When targeting netcore3.1 and loading an assembly that depends on a net5.0 assembly (in this case Microsoft.Build.NuGetSdkResolver depending on System.Runtime version 5.0), it can fail to load.

It fails on line 118 of SdkResolverService

                 result = (SdkResult)sdkResolver.Resolve(sdk, context, resultFactory);
"System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at Microsoft.Build.NuGetSdkResolver.NuGetSdkResolver.Resolve(SdkReference sdkReference, SdkResolverContext resolverContext, SdkResultFactory factory)
   at Microsoft.Build.BackEnd.SdkResolution.SdkResolverService.ResolveSdk(Int32 submissionId, SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath, Boolean interactive)

"

We should consider changing MSBuildLocator to NOT return .NET Core SDK's that are newer than the current .NET Core runtime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions