Praveen Kumar

Praveen Kumar

  • 351
  • 6.3k
  • 1.9m

How to install System.Management.dll into GAC Where gacutil is missing

Apr 10 2021 7:18 AM

How to install/add System.Management.dll into GAC where gacutil.exe is not available at the host server. Manual copy paste is not working.

Problem Description

I have a C#.NET 3.5 application where I am using System.Management namespace to read USB Serial Device. Following code is working fine at development machine but when we deploy this exe on the server where System.Management.dll is available into target framework directory but it is missing at GAC location (file:///C:/windows/assembly/GAC_MSIL/System.Management/ ).
Exception StackTrace
System.Management.ManagementException: Not found
at System.Management.ManagementScope.Initialize()
at System.Management.ManagementObjectSearcher.Initialize()
at System.Management.ManagementObjectSearcher.Get()
at ComPort.Form1.GetUSBDevices() in E:\NPPC\PRAVEEN\POC\ComPort\ComPort\Form1.cs:line 46
at ComPort.Form1.BindDDL() in E:\NPPC\PRAVEEN\POC\ComPort\ComPort\Form1.cs:line 28
at ComPort.Form1.button1_Click(Object sender, EventArgs e) in E:\NPPC\PRAVEEN\POC\ComPort\ComPort\Form1.cs:line 36
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Answers (3)