microsoft / MSBuildLocator

An API to locate MSBuild assemblies from an installed Visual Studio location. Use this to ensure that calling the MSBuild API will use the same toolset that a build from Visual Studio or msbuild.exe would.
Other
218 stars 83 forks source link

Fix NullReferenceException in GetDevConsoleInstance() #66

Closed ap0llo closed 5 years ago

ap0llo commented 5 years ago

Fixes #65

When the environment variable VSINSTALLDIR was set but VisualStudioVersion was not, GetDevConsoleInstance() was throwing a NullReferenceException because a null-Version was passed to the VisualStudioInstance constructor.

This PR adds a check to ensure version is not null. If the version is null, GetDevConsoleInstance will return null (i.e. no VS instance found)