When developing a plugin against Studio 2017 I was able to determine the current version of Studio by calling
var studio = new Studio(); var version = studio.GetStudioVersion();
var studio = new Studio();
var version = studio.GetStudioVersion();
However, when run against Studio 2019 this throws a NullReferenceException (with the standard "Object reference not set to an instance of an object." message) with this basic stack trace
at Sdl.Community.Toolkit.Core.Services.StudioVersionService.GetStudioVersion() at Sdl.Community.Toolkit.Core.Studio.GetStudioVersion()
Curiously, there's also a method studio.GetInstalledStudioVersion(), which returns
...even though I have both 2017 and 2019 installed.
Ultimately what I'm trying to achieve is the path to the user's default 'Projects' directory.
Can anyone explain
Hello Andrew Jameson
The Sdl.Community.Toolkit.Core package version for Studio 2019 and Studio 2017 can be installed from Visual Studio NuGet (see below attached image):
Both methods studio.GetStudioVersion() and studio.GetInstalledStudioVersion() should work witouth any errors, if the correct version of the Sdl.Community.Toolkit.Core, based on the application compatibility with Studio is used.
With kind regards,