dotnet / codeformatter

Tool that uses Roslyn to automatically rewrite the source to follow our coding styles
MIT License
1.24k stars 244 forks source link

Web projects require Visual Studio 2015 installation #228

Open michalhosala opened 8 years ago

michalhosala commented 8 years ago

Your readme.md says:

In order to build or run this tool you will need to have Microsoft Build Tools 2015 installed.

However, that is not enough for web projects. To reproduce:

Prerequisities:

Steps to reproduce:

  1. Run CodeFormatter.exe WebProj.sln,
  2. Observe exception being thrown:

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> Microsoft.Build.Exceptions.InvalidProj ectFileException: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Micr osoft.WebApplication.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. C:\Users\Administrator\Desktop\Projects\VbWebApplication\VbWebApplication\VbWebApplication.vbproj at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLoca tion elementLocation, String resourceName, Object[] args) at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(IElementLocation elementLocation, String resource Name, Object arg0) at Microsoft.Build.Evaluation.Evaluator4.ExpandAndLoadImports(String directoryOfImportingFile, String importExpressi onEscaped, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) at Microsoft.Build.Evaluation.Evaluator4.Evaluate() at Microsoft.Build.Evaluation.Evaluator4.Evaluate(IEvaluatorData4 data, ProjectRootElement root, ProjectLoadSetting s loadSettings, Int32 maxNodeCount, PropertyDictionary1 environmentProperties, ILoggingService loggingService, IItemFac tory2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCache projectRootElementCache, BuildEventContext buildEventContext, ProjectInstance projectInstanceIfAnyForDebuggerOnly) at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation) at Microsoft.Build.Evaluation.Project.Initialize(IDictionary2 globalProperties, String toolsVersion, String subTools etVersion, ProjectLoadSettings loadSettings) at Microsoft.Build.Evaluation.Project..ctor(ProjectRootElement xml, IDictionary2 globalProperties, String toolsVersi on, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings) at Microsoft.CodeAnalysis.MSBuild.ProjectFileLoader.d5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.MSBuild.ProjectFileLoader.d3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.d40.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.d39.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.d34.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at CodeFormatter.Program.d4.MoveNext() in E:\codeformatter\src\CodeFormatter\Program.cs:line 12 6 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at CodeFormatter.Program.d__3.MoveNext() in E:\codeformatter\src\CodeFormatter\Program.cs:line 103 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait(CancellationToken cancellationToken) at CodeFormatter.Program.RunFormat(CommandLineOptions options) in E:\codeformatter\src\CodeFormatter\Program.cs:line 76 at CodeFormatter.Program.Main(String[] args) in E:\codeformatter\src\CodeFormatter\Program.cs:line 39

Expected behavior: