0

Hi I am creating a c# dll with below code

 using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; namespace imageexport { [ComVisible(true)] public class ExportImage { [ComVisible(true)] public void exportPNG(String pDirectory,String svgFileName,String outputFileName) { String arguments= pDirectory+"res\\include\\highcharts-convert.js -infile "+pDirectory+"res\\graphs\\"+svgFileName+" -outfile "+pDirectory+"res\\graphs\\"+outputFileName +" -scale 2.5 -width 1088"; /*using (StreamWriter writer = new StreamWriter("c:\\debug.txt", true)) { writer.WriteLine("pDirectory=" +pDirectory); writer.WriteLine("arguments="+arguments); }*/ Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = false; p.StartInfo.FileName = pDirectory+"res\\bin\\phantomjs.exe"; p.StartInfo.Arguments = arguments; p.Start(); p.WaitForExit(); } } } 

For creating dll I do configuration as below in VS2005

 Application Assembly Name -> imageexport Default Namespace - > imageexport outputtype => Classlibrary startup object ->(Not Set) Assembly Information : a) Assembly Version ->1 0 0 0 b)File Version ->1 0 0 0 c) Make Assembly Com visible ->checked  Build  Configuration -> Active (Debug) Platform ->Active (Any CPU) General : a)conditional Compilation Symbols -> blank b) Define Debug Constant ->checked c) Define Trace Constant -> checked d) platform Target -> Any CPU e) allow unsafe code -> not checked f) optimize code -> not checked g) warning lavel -> 4 h) Supperess warning -> blank i) Treat Warnign errors -> None 

Now after this I register the imageexport.dll with regasm of .net 2.0

Now when I look registry then under HKEY_CLASSES_ROOT I found imageexport.ExportImage.

Now in vbscript below code is use to create object and call the function

 Dim obj Set obj = CreateObject("imageexport.ExportImage") obj.exportPNG rvPAWZDirectoryPath&"\","SVGData_"&Session("export_time")&".svg","Export_" & export_time & ".png" 

But this give exception named 'UnknownException' at the line createObject in VBSCript. Please tell me where is the problem

3
  • What happens if you run exportPNG from a C# client? Just wonder if that is throwing. Commented Jul 1, 2013 at 10:49
  • No, When I use this dll in c# console application then it works fine. Commented Jul 1, 2013 at 11:30
  • Hi, now when I uncomment the file writing code, and run this after system restart then debug.txt is creating fine. Now the only issue is phantomjs.exe is not getting execute, while this gets execute when I call this from console application. Commented Jul 2, 2013 at 6:54

1 Answer 1

8

I think you should register your Dll as:

 C:\Windows\Microsoft.NET\Framework64\v4.0.30319>regasm yourDllPath /codebase 

Now you can create object of your Dll.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.