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

MSBuildWorkspace 2.8.2 doesn't work out of the box with VS 15.8.1 #29436

Closed
ziriax opened this issue Aug 22, 2018 · 2 comments
Closed

MSBuildWorkspace 2.8.2 doesn't work out of the box with VS 15.8.1 #29436

ziriax opened this issue Aug 22, 2018 · 2 comments
Assignees
Labels
Area-IDE Bug Resolution-External The behavior lies outside the functionality covered by this repository
Milestone

Comments

@ziriax
Copy link

ziriax commented Aug 22, 2018

Maybe this is not a bug, but I'm reporting it here anyway, for feedback.

Version Used:

Visual Studio 2017 Professional 15.8.1

<PackageReference Include="Microsoft.CodeAnalysis" Version="2.8.2" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.0.18" />

Steps to Reproduce:

  1. Create a new .NET Framework console app (I tried 4.6.2 and 4.7.1, same behavior)
  2. Add the above package references to the csproj file
  3. Modify Program.cs to call
Microsoft.Build.Locator.MSBuildLocator.RegisterDefaults();
Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.Create();

Expected Behavior:
The program runs without throwing any exceptions.

Actual Behavior:
The program throws a ReflectionTypeLoadException exception, with nested LoaderExceptions:
Could not load file or assembly 'System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Note that when building you indeed get a warning some incorrect version, but the csproj file contains

<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

so I was expecting this to be no problem.

Workaround:

Also add

<PackageReference Include="System.Collections.Immutable" Version="1.5.0"/>

to your csproj file

This seems very related to #17705 (possibly a duplicate?)

Note that I wasn't able to use 2.9, because I then got bitten by #29122

@ziriax ziriax changed the title MSBuildWorkspace 2.8.2 doesn't work out of the box anymore with VS 15.8.1 MSBuildWorkspace 2.8.2 doesn't work out of the box with VS 15.8.1 Aug 22, 2018
@jinujoseph jinujoseph added this to the 16.0 milestone Aug 23, 2018
@DustinCampbell
Copy link
Member

@ziriax : Making a version of MSBuildWorkspace prior to 2.9 work with VS 2017 is a bit tricky. I think your workaround is probably the right one. However, I don't think this is really an MSBuildWorkspace issue that we can solve.

@DustinCampbell DustinCampbell added the Resolution-External The behavior lies outside the functionality covered by this repository label Oct 3, 2018
@ziriax
Copy link
Author

ziriax commented Oct 3, 2018

With VS15.8.5, another workaround is needed, you need to import the System.Threading.Tasks.Dataflow package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug Resolution-External The behavior lies outside the functionality covered by this repository
Projects
None yet
Development

No branches or pull requests

3 participants