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

Locating MSBUILD fails if multiple installed versions match version range #123

Closed freudi74 closed 3 years ago

freudi74 commented 3 years ago

I know you claim the project deprecated in favor of the dotnet plugin, but I find it very useful to build MSVC++ projects from gradle. I have recently encountered a problem, though.

When you select a version range, and multiple installed versions that are detected by vswhere satisfy that version range, then the plugin fails. Root cause seems to be, that when setting a version, the MSBuildResolver.findMsbuildByVsWhere() is not adding the "-latest" to the call to vswhere, but the handling of the results from the command line expects only one instance to be reported by vswhere. Combining "-version ..." with "-latest" would work perfectly fine.

ngyukman commented 3 years ago

hi @freudi74

the plugin doesn't really support a version range when specified in the msbuild version as per code if the version is not specified it take the latest already which should suit most of the use case what is the reason behind having both version range in the build.gradle while couldn't just use latest?

freudi74 commented 3 years ago
ngyukman commented 3 years ago

thanks for your explanation

ngyukman commented 3 years ago

Fixes in https://github.com/Itiviti/gradle-msbuild-plugin/commit/bccd066669b7a33b025f1d68ece53722087279c3