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:
machine without VS2015 installed,
with MS Build Tools 2015 installed,
web project, e.g. basic template from VS2012 "ASP.NET Empty Web Application", lets call it WebProj.sln
Steps to reproduce:
Run CodeFormatter.exe WebProj.sln,
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:
Either I would expect the VS2015 to be stated as a prerequisite of the CodeFormatter,
Or CodeFormatter should not need file VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets to work in this scenario,
Or to state in your docs that you are not supporting web projects
Your readme.md says:
However, that is not enough for web projects. To reproduce:
Prerequisities:
Steps to reproduce:
CodeFormatter.exe WebProj.sln
,Expected behavior:
VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets
to work in this scenario,