From: | Abhay Sobti |
To: | Rick Strahl |
Abhay
Hmmm... that seems odd. GAC'd assemblies should always be accessible as they are 'trusted' once installed...
I'm curious: Is this true of other assemblies as well or just this one?
What happens when you run this w/o Admin priviliges:
DO wwDotnetBridge*** Create instance of wwDotnetBridge - this example requires .NET 4.0LOCAL loBridge as wwDotNetBridge loBridge = CreateObject("wwDotNetBridge","V4") && .NET 4.0 *** Load a GAC assembly (full .NET type name required) loBridge.LoadAssembly("System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")*** Load a private assembly from disk * ? loBridge.LoadAssemblY("c:\apps\myapp\myappassembly.dll") *** Create an instance of the JavaScript Serializer loSer = loBridge.CreateInstance("System.Web.Script.Serialization.JavaScriptSerializer") lcValue = "Hello World" + CHR(13) + CHR(10) + "Here's what I've got!"*** Serialize string to JSON lcJson = loSer.Serialize(lcValue)*lcJson = loBridge.InvokeMethod(loSer,"Serialize",lcValue) ? lcJson*** Create a .NET Type object for string loType = loBridge.GetType("x")*** Deserialize with the .NET type provided ? loSer.Deserialize(lcJson,loType) ? loBridge.InvokeMethod(loSer,"Deserialize",lcJson,loType)
+++ Rick ---
Aah ! Found the issue !! The problem was not with the Assembly itself, but with the access. I dont know how that happened, but running the code as "Run as Administrator" solved the issue.
Abhay
Not sure about that. Does the component work from .NET?
+++ Rick ---
Hi everyone,
I am not a professional DotNet programmer and so this basic question.
I have built the WkHtmlToXSharp.dll file using the freely available source code. I want to install this assembly in the GAC so that All my applications on the local machine can access this assembly using its Fully Qualified assembly name. However, this DLL has a dependency on Common.Loggin.Dll. So, I have used the ILMERGE utility to add the two assemblies as follows :
ilmerge.exe /keyfile:wkHtmlToXSharp.snk /target:library /out:ssWkHtmlToXSharp.dll Common.Logging.Dll WkHtmlXSharp.dll
Now I install the ssWkHtmlToXSharp.dll to the target machines using Installshield.
The problem is : When I try to instantiate the object using the following commands, an error occurs :
oBridge = NEWOBJECT("wwDotNetBridge","\shcommon\wconnect\classes\wwDotNetBridge.prg","",[V4]) oBridge.LoadAssembly("ssWkHtmlToXSharp, Version=2.0.0.0, Culture=neutral, PublicKeyToken=a62b1b93e623d45b") oConvertor = oBridge.CreateInstance("WkHtmlToXSharp.WkHtmlToPdfConverter")
The error displayed is [using oBridge.cErrorMsg]:
Access to the path 'C:\Windows\assembly\GAC_MSIL\ssWkHtmlToXSharp\2.0.0.0__a62b1b93e623d45b\wkhtmltox0.dll' is denied.
Any help will be welcome.
Thanks
Abhay
-- Abhay