roslyn: Roslyn 2.0 unable to compile TypeScript enabled web project

Version Used:

Roslyn 2.0.0.0 Visual Studio 2015 SP3

Steps to Reproduce:

  1. Create an empty Visual Studio 2015 web project
  2. Add a TypeScript File to the web project
  3. Run the following code against the web project:
var msWorkspace = MSBuildWorkspace.Create();
var solution = msWorkspace.OpenSolutionAsync(PathToSolution).Result;
var projects =
	solution.GetProjectDependencyGraph()
		.GetTopologicallySortedProjects()
		.Select(solution.GetProject)
		.ToList();
foreach (var project in projects)
{
	var compilation = project.GetCompilationAsync().Result;
	var errors = compilation
		.GetDiagnostics()
		.Where(a => a.Severity == DiagnosticSeverity.Error)
		.ToList();
	if (errors.Any())
	{
		Console.WriteLine($"Project {project.Name} had {errors.Count()} compilation errors");
	}
	else
	{
		//use compilation if successfull......
	}
}

I was also able to reproduce the issue with a Visual Studio 2017 web project that is TypeScript enabled.

Expected Behavior:

The project will compile with no errors.

Actual Behavior:

The project has errors.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

@red-man that second error (without MSBUILD_EXE_PATH) set, seems like the standard problem on not having the correct redirects in your app.config. Do you have the same redirects that msbuild.exe.config has? (the one under C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0).