c# - System.Type.GetTypeFromProgID(VisualStudioProgId) return null
问题描述
Please help me:
Machine 1: win2007
(works fine)
Machine 2: winServer 2019 Datacenter
(Facing issue)
On Both machines: Same C# code is executed on VS2019
and i want to invoke VS2017
C# Code:
string VisualStudioProgId = "VisualStudio.DTE." + vsVersion;
Type type = System.Type.GetTypeFromProgID(VisualStudioProgId);
EnvDTE80.DTE2 dte = (EnvDTE80.DTE2)System.Activator.CreateInstance(type,true);
- The code is working fine on machine 1(win2007)
- On Machine 2(winServer 2019) - Unhandled Exception is reported:
I tried to debug C# code further in VS2019 in both machines
Observed different type
for Class System Type
:
Machine (win2007)(works fine):
Class System Type
observed as
Value: {Name = "__ComObject" FullName = "System.__ComObject"}
Type: System.Type {System.RuntimeType}
Machine (winServer 2019)(Facing issue):
Class System Type
observed as
Value: null
Type: System.Type
解决方案
I have installed many more packages after looking in to VS installation in the machine(win2007)
which is working.
Now machine with winServer 2019
is also working. But i don´t now which package solved the problem.
Installed many more packages
Microsoft Visual Studio Community 2017
Version 15.9.36
VisualStudio.15.Release/15.9.36+28307.1525
Microsoft .NET Framework
Version 4.8.03761
Installed Version: Community
ASP.NET and Web Tools 2017 15.9.04012.0
ASP.NET and Web Tools 2017
ASP.NET Core Razor Language Services 15.8.31590
Provides languages services for ASP.NET Core Razor.
ASP.NET Web Frameworks and Tools 2017 5.2.61435.0
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 15.9.03024.0
Azure App Service Tools v3.0.0
C# Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
JavaScript Language Service 2.0
JavaScript Language Service
Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager 1.0
Install client-side libraries easily to any web project
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
SQL Server Data Tools 15.1.62002.01090
Microsoft SQL Server Data Tools
TcProjectCompare 1.0
Visual Studio Integrated Version of TcProjectCompare
TcXaeDebuggerLiveWatch 1.0
TwinCAT XAE Live Watch Tool Window
TcXaeHelper 1.0
Info
TcXaeModules 1.0
TwinCAT TMC Editor, TwinCAT TMC Code Generator
TcXaeStartPage 1.12
Beckhoff Start Page for TwinCAT XAE
TwinCAT XAE Base 3.1.0.0
The TwinCAT XAE Base extension provides the basic project structure for TwinCAT projects.
TwinCAT XAE EventLogger 1.0
The TwinCAT XAE Eventlogger extension provides the capability of monitoring events sent through the TwinCAT 3 Eventlogger of a target system.
TwinCAT XAE PLC 3.1.0.0
PLC Environment
TypeScript Tools 15.9.30718.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers
推荐阅读
- java - 数组存储了太多值
- javascript - 在打字稿编译期间从输出中排除“src”文件夹?
- google-bigquery - 一个 BigQueryOperator 的模板化 destination_dataset_table arg 作为另一个模板化的 From
- java - ReactiveSecurityContextHolder.getContext() 为空,但 @AuthenticationPrincipal 有效
- android - 如何在 Android 应用中保存特定的片段状态
- r - 针对独立测试集绘制重采样结果
- design-patterns - 数组中的后备服务的设计模式是什么
- selenium - 使用 Selenium 制作 Google Keep 列表,如何访问新的笔记属性?
- google-apps-script - 将部分从一个表单复制到另一个表单
- powershell - 如何使用 Start-Process 在会话中使用本地 PowerShell 变量?