dotnet / dotnet/msbuild

MSBuild does not generate assembly redirects -> results in a runtime MissingMethodException

Open
#3,662 0 comments 1 reaction 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

MSBuild generates assembly redirects nowadays - am I correct? I'm a bit confused why the attached sample project succeeds ([WORKS.zip](https://github.com/Microsoft/msbuild/files/2326898/WORKS.zip)), but as soon as I add the NuGet package reference "Microsoft.Extensions.DependencyInjection" v1.1.1 it fails ([FAILS.zip](https://github.com/Microsoft/msbuild/files/2326899/FAILS.zip)).

Shouldn't MSBuild generate an assembly redirect for System.IO.Compression so that only one version is loaded? (and so I don't run into a MissingMethodException in the FAILS.zip example)

I want to understand why no assembly redirect is generated in this scenario and whether this is by-design or whether it is a bug.

### Expected behavior
Assembly redirect for System.IO.Compression

### Actual behavior
No assembly redirect, System.IO.Compression is loaded twice into memory, in two different versions, which results in a MissingMethodException in my repro example.

### Environment data
`msbuild /version` output:
Microsoft (R) Build Engine version 15.8.166+gd4e8d81a88 for .NET Framework

OS info:
Windows 10

If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
Visual Studio 15.8

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.