Itiviti / gradle-msbuild-plugin

Gradle plugin for msbuild execution, supports C# project files for now
Apache License 2.0
101 stars 58 forks source link

Error during project file parsing: Microsoft.Build.Exceptions.InvalidProjectFileException: The tools version "14.1" is unrecognized. Available tools versions are "2.0", "3.5", "4.0". #90

Closed Horcrux7 closed 6 years ago

Horcrux7 commented 6 years ago

After upgrading Visual Studio to version 2017 I receive the follow error:

Error during project file parsing: Microsoft.Build.Exceptions.InvalidProjectFileException: The tools version "14.1" is unrecognized. Available tools versions are "2.0", "3.5", "4.0".  C:\workspace_trunk\ProcessBridge.NET\ProcessBridge\ProcessBridge.csproj
   bei Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
   bei Microsoft.Build.Evaluation.Project.Data.InitializeForEvaluation(IToolsetProvider toolsetProvider)
   bei Microsoft.Build.Evaluation.Evaluator`4..ctor(IEvaluatorData`4 data, ProjectRootElement projectRootElement, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCache projectRootElementCache, BuildEventContext buildEventContext, ProjectInstance projectInstanceIfAnyForDebuggerOnly)
   bei Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation)
   bei Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings)
   bei Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
   bei Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
   bei Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName)
   bei ProjectFileParser.ProjectHelpers.LoadProject(String fullPath, IDictionary`2 args)
   bei ProjectFileParser.ProjectHelpers.<>c__DisplayClass0_0.<GetProjects>b__1(ProjectInSolution p)
   bei System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   bei System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   bei System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   bei ProjectFileParser.ProjectHelpers.GetProjects(SolutionFile solution, IDictionary`2 args)
   bei ProjectFileParser.Program.ParseSolution(String file, JObject args)
   bei ProjectFileParser.Program.Parse(String file, JObject args)
   bei ProjectFileParser.Program.Main(String[] args)

With the follow debug lines:

msbuild {
   println getCommandLineArgs()
   println msbuild.msbuildDir
}

I can see the right msbuild tool version 15 from VS 2017. But the tool ProjectFileParser.exe seems to use a different version of the tool. How can I solve the problem? How the msbuild.exe are searched in the tool ProjectFileParser.exe?

ngyukman commented 6 years ago

Hi @Horcrux7 #77 is the an attempt to fix the issue, please feel free to comment and try out to see if that solves your issue

ngyukman commented 6 years ago

gradle-msbuild-plugin 2.19 is released

Horcrux7 commented 6 years ago

I can not download the files from jcenter. There are no files: https://bintray.com/ullink/gradle-plugins/com.ullink.gradle%3Agradle-msbuild-plugin/2.19#files/com%2Fullink%2Fgradle%2Fgradle-msbuild-plugin

ngyukman commented 6 years ago

I am sorry that the release has some problems and the file name is wrong, I have re-upload again, please try again, thanks