4

I am trying to open a ReqPro project from c# class code. The steps followed are:

  1. Add reference to ReqPro.dll (the extensibility COM dll)
  2. Create a type of ReqPro40.Application and have an instance of ReqPro40.ApplicationClass like:

    ReqPro40.Application appReqPro = new ApplicationClass();
    ReqPro40.Project prjReqPro;
    prjReqPro = appReqPro.OpenProject(@"D:\MyReqPro\MyReqPro.rqs", ReqPro40.enumOpenProjectOptions.eOpenProjOpt_RQSFile, "admin", "admin", ReqPro40.enumProjectFlags.eProjFlag_Normal, ReqPro40.enumRelatedProjectOptions.eRelatedProjOption_ConnectNone);
    

The code compiles well, but when run (I wrote a simple Unit test), it fails saying "Could not load file or assembly 'Interop.ReqPro40, Version=1.10.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"Interop.ReqPro40, Version=1.10.0.0, Culture=neutral, PublicKeyToken=null".

Update1:

I tried it on my laptop, and it worked fine. I have ReqPro installed on my laptop. But it does not work on the server (Windows 2008 Enterprise). I connect to the server using remote connection. Any clue?

Update for bounty

I shall expect some working code with steps to recreate.

Kangkan
  • 15,267
  • 10
  • 70
  • 113

1 Answers1

2

Please check on the server that the ReqPro.dll is in the root folder, sometimes the referenced dll's dont copy to the bin folder. You can also specify a "Probing" element in your app.config file to specify subfolders that the CLR can search to locate a referenced assembly if it cannot find the assembly.

<configuration>
   <runtime>
       <assemblyBinding xmlns="urn:schmas-AWorks-cam:asm.v1">
           <probling privatePath="bin\Ordersbin;Extbin"/>
       </assemblyBinding>
   </runtime>
</configuration>

Update: If you arn't already I would suggest you use a Setup Project to Install your Project, this will make sure any 3rd party dlls, automatically get copied to the root folder were the application is installed.

Jethro
  • 5,896
  • 3
  • 23
  • 24
  • Oh good, I was running out of ideas - should have thought of something so simple! Here I was all going down the COM DLL registration problem path ... :) – The Evil Greebo Jun 28 '11 at 12:55
  • But, I still have an issue. I was trying to test the functionality using unit test (MS Unit). While the code now runs from the unit test, it does not run if I invoke it from a windows form. Can you please help out? – Kangkan Jun 30 '11 at 08:56
  • @The Evil Greebo: You might be right. The issue is yet to be solved. – Kangkan Jun 30 '11 at 08:57
  • Are you getting any kind of Exception or error when you run it from windows form? – Jethro Jun 30 '11 at 10:13
  • Assuming your unit test is in a separate project from the windows form, have you verified that all of your references in both projects are *exactly* identical (down to the version and file paths etc)? – The Evil Greebo Jun 30 '11 at 11:48