Open
Description
Version Used:
4.13.0-2.24561.4
Steps to Reproduce:
- Create a console application and add packages, 'Microsoft.CodeAnalysis' and 'Microsoft.CodeAnalysis.Workspaces.MSBuild' (version 4.13.0-2.24561.4).
The project file will be as follows:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.13.0-2.24561.4" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.13.0-2.24561.4" />
</ItemGroup>
</Project>
- Add this code fragment to the 'Main' method:
var workspace = MSBuildWorkspace.Create();
_ = workspace.OpenSolutionAsync("D:\\ MySolution.sln").Result;
- Create a console app in a project templates for Visual Studio 2015. Open the project using the program created above.
Expected Behavior:
No exception.
Actual Behavior:
Exception is thrown:
Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.<GetBuildHostAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.<GetBuildHostWithFallbackAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
....
Note: We would like to note that this issue is critical for us. We would be grateful if you could assist us in fixing it. Furthermore, we would deeply appreciate it if you could tell us if there are any known possible workarounds.
This information may help you: MSBuildLocator can successfully register MSBuild for Visual Studio 2015.
MSBuildLocator.RegisterMSBuildPath(@"C:\Program Files (x86)\MSBuild\14.0\Bin");