Visual Studio Setup Configuration Samples

The included samples show how to use the new setup configuration API for discovering instances of Visual Studio "15".

 
 
 
 
 
(0)
1,213 times
Add to favorites
9/10/2016
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • How do I get the ChannelID of Visual Studio Installation from this API
    1 Posts | Last post September 08, 2017
    • Using vswhere.exe gives the channel id of Visual Studio, from which I can make our if it  is Standard / Preview. How can I get the channel ID from this API? Thanks
  • /rootsuffix EXP
    1 Posts | Last post May 24, 2017
    • How do I find whatever is installed in the EXP branch/hive of an instance? I'm attempting to drive a DTE object to load a solution in the EXP branch but in the instance where the EXP branch contains certain VSIX packages.
      
      Help?
  • How do we get the SKU name of the installed instance.
    1 Posts | Last post May 04, 2017
    • Hi Heath,
      
      We use ISetupInstance2.GetProduct() -> ISetupFailedPackageReference.GetId() to get the id of the package reference to the product registered to the instance which seems to contain the SKU name (Enterprise, Professional, Community...) of Visual Studio. This however is not robust because ISetupInstance2.GetProduct() returns NULL when the installation of Visual Studio is not complete somehow. Is there more appropriate way to get the SKU name?
      
      Regards,
      Vesko
  • Do we need to import Microsoft.VisualStudio.Setup.Configuration.Native.dll?
    2 Posts | Last post March 03, 2017
    • Hi Heath,
      
      Thank you for sharing these examples.
      
      Is there a case when new SetupConfiguration(); crashes with COMException (REGDB_E_CLASSNOTREG) and there is a VS2017 instance installed? If there is no such case it seems that GetSetupConfiguration(out query, IntPtr.Zero); would always return 0 in the catch block. Do we really need to import Microsoft.VisualStudio.Setup.Configuration.Native.dll and have this module as a local resource in our VS2017 detection logic?
      
      Regards,
      Vesko
    • It's possible I'd someone unregistered the DLLs, but to be no sane reason to do so. I'd consider that a user error.
      
      There's really no reason to ship the DLL, not should you. We have and will continue to update it, so you'd just be shipping an old copy in no time. Just rely on normal COM loading.
  • What is this error?
    2 Posts | Last post January 05, 2017
    • I have VS2017 CE installed on a VM and tried a very simple:
      
                  var test = new SetupConfiguration();
                  var instance = test.GetInstanceForCurrentProcess();
      
      I get this error.  Any ideas?
      
      System.Runtime.InteropServices.COMException: 'Element not found. (Exception from HRESULT: 0x80070490)'
    • Earlier versions only enumerated valid (complete) instances even if you're asking for the current. Later versions (starting RC, I believe) will check for any instance regardless of state. So this seems like an early-version problem. What is the version of the binary you're using?
  • What is the intended way to handle missing native assembly on machines with no VS2017 instances?
    3 Posts | Last post December 28, 2016
    • When I run the C# example on machine without VS2017 it fails with the following error:
      
      Error 0x80131524: Unable to load DLL 'Microsoft.VisualStudio.Setup.Configuration
      .Native.dll': The specified module could not be found. (Exception from HRESULT:
      0x8007007E)
      
      Microsoft.VisualStudio.Setup.Configuration.Interop uses the GetSetupConfiguration method of Microsoft.VisualStudio.Setup.Configuration.Native.dll through DllImport and that seems to be the cause.
      
      I'm trying to use this API to detect VS2017 instances with a managed Custom Action in MSI and the scenario where the MSI is started on the machine without VS2017 is common. Also the Native assembly NuGet cannot be installed to the managed project. It seems I will have to add this assembly to be carried with my assembly without using the NuGet package but I was wondering if some better way to handle this scenario is intended.
      
      Thanks.
    • It's odd you're seeing that instead of REGDB_E_CLASSNOTREG - perhaps the RACE wraps it on some versions or somehow the class was registered but no DLLs installed - but you should treat it the same: any errors to load the query API should yield the conclusion no instances are installed (since the DLLs are not installed, which means we can't really handle it any other way).
    • Note that "RCW" was auto-corrected to "RACE" but I can't seem to edit my comment.
  • ISetupHelper.ParseVersionRange not implemented?
    2 Posts | Last post December 10, 2016
    • I'm trying the interfaces and everything works fine except for the ISetupHelper.ParseVersionRange. I'm getting the NotImplemented exception when I try to call it. On the other hand, the ISetupHelper.ParseVersion works fine. Is this a problem on my side, or isn't this method implemented?
      
      Thank you
    • That is correct. It is not yet implemented but will be soon to support discovery scenarios.