I need to install an assembly in GAC using c#. Below is my code:
new System.EnterpriseServices.Internal.Publish().GacInstall("MyAssembly.dll");
The above code gives the error:
Absolute path required
But i need this to run without using static file path (absolute path). Can anyone tell me whether its possible? I have added the reference to the assembly inside the project references. I need to install this assembly inside GAC.
There are two ways to remove an assembly from the global assembly cache (GAC): By using the Global Assembly Cache tool (Gacutil.exe). You can use this option to uninstall assemblies that you've placed in the GAC during development and testing. By using Windows Installer.
You could do something like:
GacInstall((new System.IO.FileInfo("MyAssembly.dll")).FullName);
or,
GacInstall(System.IO.Path.GetFullPath("MyAssembly.dll"));
Assuming that the file is in your current working directory. If it's not, then you need to define what rules are being used to find this DLL (e.g. is it in the same path as your current executable?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With