- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
关于如何使用 PID(可以在 HKLM\SYSTEM\Setup\Pid
注册表项中找到)和 ProductID(可以在 HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion
中找到)来检测 Windows 许可证类型和分发 channel ,网上有很多信息。
但是,关于如何检测用于安装其他 Microsoft 产品的许可类型的信息很少。
也就是说,我需要确定哪些是使用 MSDN 订阅许可证安装的,哪些是使用其他许可证类型安装的。
通过分析产品 GUID(在 Uninstall
注册表分支中找到),我设法找到了一些关于 Office 风格的信息:
最佳答案
Visual Studio 2010
The detection keys for Visual Studio are used both to detect if the product is installed and what service pack level is installed. As with previous versions, these keys and values are under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing.
Key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing\10.0\$(var.ProductEdition)\$(var.LCID)
Name Install
Type REG_DWORD (32-bit integer)
Data 0x00000001 (1)
The values for $(var.ProductEdition) include the following table. The for other products, this value corresponds to the ProductEdition property in the Property table of the Windows Installer package for that product. The locale IDs for $(Var.LCID) are listed here.
Visual Studio 2010 Ultimate VSTSCore
Visual Studio 2010 Premium VSTDCore
Visual Studio 2010 Professional PROCore
Visual Studio 2010 Shell (Integrated) IntShell
For Dev10 we have also added detection values to the edition keys so that you do not have to detect every single language for ever edition.
Key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing\10.0\$(var.ProductEdition)
Name Install
Type REG_DWORD (32-bit integer)
Data 0x00000001 (1)
These registry keys and values are also used to detect the service pack level. Instead of checking for the Name registry value, check the SP registry value. Ignore SPIndex; Microsoft uses this internally. In addition to the registry keys above, we also set a version-dependent registry value listed below.
Key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing\10.0
Name SP
Type REG_DWORD (32-bit integer)
Data 0x00000001 (1)
Keep in mind, however, that as with all shared resources the more shared a resource is the less accurate it may be. This is because there is no version policy for registry values and other resources that do not have versions like text files. If two languages were installed at different servicing pack levels – which is unsupported but possible – the value would be set by the last product to be installed or reinstalled (repaired).
For more information, see the Visual Studio 2010 detection system requirements. This also includes information to use the CompLocator in your Windows Installer package as an alternative to registry detection.
To detect which Visual Studio version a (multi-IDE) add-in is running under, you can use the EnvDTE.DTE.RegistryRoot property, which can return the following values:
For Visual Studio 2005: Software\Microsoft\VisualStudio\8.0
For Visual Studio 2008: Software\Microsoft\VisualStudio\9.0
To detect the edition and subedition of the Visual Studio IDE you can use the IVsShell interface, calling its GetProperty method with the Microsoft.VisualStudio.Shell.Interop.__VSSPROPID2.VSSPROPID_SKUEdition and Microsoft.VisualStudio.Shell.Interop.__VSSPROPID2.VSSPROPID_SubSKUEdition values.
Note: To get a service from an add-in, see HOWTO: Get a Visual Studio service from an add-in; and to know how to reference an assembly from the GAC (such as Microsoft.VisualStudio.Shell.Interop.dll), see HOWTO: Reference a Visual Studio assembly in the GAC from an add-in.
The returned results are not well documented but some values are provided in the following sample add-in:
Imports System
Imports Microsoft.VisualStudio.CommandBars
Imports Extensibility
Imports EnvDTE
Imports System.Runtime.InteropServices
Imports Microsoft.VisualStudio.Shell.Interop
Imports System.Windows.Forms
<ComVisible(True), ComImport(), Guid("6D5140C1-7436-11CE-8034-00AA006009FA"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _
Friend Interface IServiceProvider
<PreserveSig()> _
Function QueryService(<InAttribute()> ByRef guidService As Guid, _
<InAttribute()> ByRef riid As Guid, <OutAttribute()> ByRef ppvObject As IntPtr) As Integer
End Interface
Public Class Connect
Implements IDTExtensibility2
Private Enum SKUEdition
SKUEdition_None = 0
SKUEdition_Express = 500
SKUEdition_Standard = &H3E8
SKUEdition_Professional = &H7D0
SKUEdition_AcademicProfessional = &H834
SKUEdition_AcademicStudent = &H834
SKUEdition_AcademicStudentMSDNAA = &H898
SKUEdition_AcademicEnterprise = &H8FC
SKUEdition_Book = &H960
SKUEdition_DownloadTrial = &H9C4
SKUEdition_Enterprise = &HBB8
End Enum
Private Enum SubSKUEdition
SubSKUEdition_None = &H0
SubSKUEdition_VC = &H1
SubSKUEdition_VB = &H2
SubSKUEdition_CSharp = &H4
SubSKUEdition_Architect = &H8
SubSKUEdition_IDE = &H10
SubSKUEdition_JSharp = &H20
SubSKUEdition_Web = &H40
SubSKUEdition_TeamEditionDevelopers = &H80
End Enum
Public Function GetService(ByVal serviceProvider As Object, ByVal type As System.Type) As Object
Return GetService(serviceProvider, type.GUID)
End Function
Public Function GetService(ByVal serviceProvider As Object, ByVal guid As System.Guid) As Object
Dim objService As Object = Nothing
Dim objIServiceProvider As IServiceProvider
Dim objIntPtr As IntPtr
Dim hr As Integer
Dim objSIDGuid As Guid
Dim objIIDGuid As Guid
objSIDGuid = guid
objIIDGuid = objSIDGuid
objIServiceProvider = CType(serviceProvider, IServiceProvider)
hr = objIServiceProvider.QueryService(objSIDGuid, objIIDGuid, objIntPtr)
If hr <> 0 Then
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(hr)
ElseIf Not objIntPtr.Equals(IntPtr.Zero) Then
objService = System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(objIntPtr)
System.Runtime.InteropServices.Marshal.Release(objIntPtr)
End If
Return objService
End Function
Public Sub OnConnection(ByVal Application As Object, ByVal ConnectMode As Extensibility.ext_ConnectMode, _
ByVal AddInInst As Object, ByRef custom As System.Array) _
Implements Extensibility.IDTExtensibility2.OnConnection
Dim objDTE As DTE
Dim objService As Object
Dim objIVsShell As IVsShell
Dim objValue As Object = Nothing
Dim eSKUEdition As SKUEdition
Dim eSubSKUEdition As SubSKUEdition
Select Case ConnectMode
Case ext_ConnectMode.ext_cm_AfterStartup, ext_ConnectMode.ext_cm_Startup
objDTE = DirectCast(Application, DTE)
objService = GetService(objDTE, GetType(IVsShell))
objIVsShell = CType(objService, IVsShell)
If objIVsShell.GetProperty(__VSSPROPID2.VSSPROPID_SKUEdition, objValue) = 0 Then
eSKUEdition = CType(objValue, SKUEdition)
MessageBox.Show(eSKUEdition.ToString)
End If
If objIVsShell.GetProperty(__VSSPROPID2.VSSPROPID_SubSKUEdition, objValue) = 0 Then
eSubSKUEdition = CType(objValue, SubSKUEdition)
MessageBox.Show(eSubSKUEdition.ToString)
End If
End Select
End Sub
Public Sub OnAddInsUpdate(ByRef custom As System.Array) _
Implements Extensibility.IDTExtensibility2.OnAddInsUpdate
End Sub
Public Sub OnBeginShutdown(ByRef custom As System.Array) _
Implements Extensibility.IDTExtensibility2.OnBeginShutdown
End Sub
Public Sub OnDisconnection(ByVal RemoveMode As Extensibility.ext_DisconnectMode, _
ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnDisconnection
End Sub
Public Sub OnStartupComplete(ByRef custom As System.Array) _
Implements Extensibility.IDTExtensibility2.OnStartupComplete
End Sub
End Class
To detect whether a specific Visual Studio package is installed or not, you can use the IsPackageInstalled method of the IVsShell interface, which receives the Guid of the package.
Detecting installed Visual Studio Service Packs
Visual Studio uses the following Windows registry entries to track the installed service packs for the several versions (2005, 2008), editions (Standard, Professional, etc.) and languages (English, Spanish, etc.):
HKEY_LOCAL_MACHINE\Software\Microsoft\DevDiv\VS\Servicing\<version>\<edition>\<localeId>
where <version> and <edition> where explained in a previous section of this article and <localeId> is 1033 for English, 3082 for Spanish, etc.
For example, when Visual Studio 2005 Team Edition for Developers has SP1 installed, the value of the "SP" registry entry of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing\8.0\VSTD\1033 is set to 1.
To know the service at general level (without taking into account the edition and language) you can use the "SP" registry entry under the registry key:
HKEY_LOCAL_MACHINE\Software\Microsoft\DevDiv\VS\Servicing\<version>
关于visual-studio - 检测 Visual Studio 许可证类型/分发 channel ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10020421/
我经常使用 SSMS 查询数据和构建数据集,我的 IT 部门负责数据库管理。 最近我发现了 Azure Data Studio,我喜欢: 智能感知 源代码控制(例如使用 Git) 来自社区的扩展 SQ
我想根据我使用的 visual studio 版本编译不同的东西,比如 #if VISUAL_STUDIO_VERSION > 2015 eventH?.Invoke(this, EventArgs.
我们的开发团队计划从 visual studio 2005 升级到 visual studio 2010 -- 跳过 visual studio 2008。 大部分项目是VB ASP.NET项目,使用
我的Visual Studio 2015无法构建2010平台工具集。它说: The build tools for Visual Studio 2010 (v100) cannot be found.
我目前正在使用 Visual Studio 2015 来编程 ASP.NET Core 应用程序。我对安装 Visual Studio 2017 有以下疑问: 什么被认为是最佳实践和/或最干净的方法?
尝试从扩展和更新获取 Visual Studio 扩展时,出现以下错误:- 向 visualstudiogallery.msdn.microsoft.com/Services/VStudio/Exte
这个问题在这里已经有了答案: Can Visual Studio Code and VS 2012 be installed on same computer? (1 个回答) 关闭去年。 在安装了
作为标准安装的一部分,Visual Studio Code 带有一个名为“Monokai Dimmed”的颜色主题。 有没有办法将它移植到 Visual Studio 2015?我检查了社区主题( h
我想开始编程 CUDA。 我已经安装了 Visual Studio 2010 Express。 我还安装了 nVidia nSight Visual Studio。 而且我具备所有常见的先决条件(Ne
Visual Studio Community Edition是否可以使用Visual Studio Online帐户上的存储库? 我一直为包含在Online帐户中的Visual Studio Onl
我有一个我一直在开发的应用程序,但在 android studio 上遇到了问题。当我点击“build->run”然后选择我的设备时,应用程序永远不会在我的手机上运行(并且自动出现的android-s
我正在使用Visual Studio2010。我面临的一个问题是,当我创建一个新的Web项目时,Visual Studio将创建该项目,并且不会在解决方案资源管理器中显示其解决方案。 另一件事是,我想
我通读了这里的许多帖子,却找不到一个有效的明确答案。因此,在花了一些时间使它生效之后,我认为应该发布它。 问题:发布配置文件将建立在服务器上,但不会发布。 解: 确保已安装Microsoft Wind
我正在尝试使用Visual Studio 2012构建针对.NET 3.5的C++ CLI应用程序。 通过安装Visual Studio 2008,并指定v90平台工具集,我已经在一台机器上进行了这项
我在 Microsoft Visual Studios 2013 中有一个项目,我想在 Microsoft Visual Studios 2010 中打开它。有什么简单的方法吗?还是我必须在2010年
我想知道,如果我发送一个解决方案文件夹(它是用 visual studio C# 编写的),您可以在 visual studio for mac 中打开解决方案吗? 在visual studio 20
有没有办法在 Visual Studio Code 和 Visual Studio 中设置相同的快捷方式(而不必每次都手动更改它们)? 例如,我在 Visual Studio Code 中经常使用 A
我刚开始了解 Visual Studio Code。我想知道,我可以将 Visual Studio 替换为所有 .NET 开发相关的工作吗? 我可以节省 Visual Studio 许可的成本吗? V
我安装了具有有效许可证(Visual Studio 订阅)的 Visual Studio 2019 企业版(VS 2019 16.1.4),它运行良好。 突然之间,当我尝试打开项目或项目中的任何文件时
我一直在使用 Compass 编译 Windows 环境中的 sass 文件,无论是在命令行上还是使用 Compass-app 来查看目录。 我刚刚开始使用 Visual Studio(专业版 201
我是一名优秀的程序员,十分优秀!