This project is read-only.


ReflectionTypeLoadException calling MSBuildWorkspace.Create on VS14


I just created a new Roslyn console app in a clean VM running VS14, and this line throws a ReflectionTypeLoadException:
var workspace = MSBuildWorkspace.Create();
with the following LoaderException:
{"Could not load file or assembly 'Microsoft.Build, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.":"Microsoft.Build, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}
I guess there is different version of MSBuild on VS14, but aren't there binding redirects? Why am I getting this error?

file attachments


hmemcpy wrote Jun 21, 2014 at 7:39 PM

Per @pilchie's suggestion on twitter: to workaround this, install the MSBuild 12 redistributable on the machine, it's available as Microsoft Build Tools 2013

Pilchie wrote Jul 25, 2014 at 9:38 PM

Starting in VS "14" CTP 2, we are targeting the VS "14" build tools, and this should work. Note that in the specific case above, another workaround would be for you to add binding redirects to the app.config file in your Roslyn Console Application, but we did not add them to the project template.