Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm writing a small program to compile my C# vis studio solutions via the command line compiler, csc.exe.

 

I'm doing this because sometimes the person compiling it will not have vis studio but will only have the .NET SDK.

 

I've got it working very smoothly, but I've come across a problem with one of my solutions. I'm looking at the .csproj file for the solution's references, and it contains a reference to a COM object and is only referenced by the GUID. How do I reference this GUID in the command line compiler?

 

The .csproj file looks like this:

 

               <Reference
                   Name = "System.Web.Services"
                   AssemblyName = "System.Web.Services"
                   HintPath = "..\..\..\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Web.Services.dll"
               />
               <Reference
                   Name = "SHDocVw"
                   Guid = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}"
                   VersionMajor = "1"
                   VersionMinor = "1"
                   Lcid = "0"
                   WrapperTool = "tlbimp"
               />
               <Reference
                   Name = "AxSHDocVw"
                   Guid = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}"
                   VersionMajor = "1"
                   VersionMinor = "1"
                   Lcid = "0"
                   WrapperTool = "aximp"
               />

 

As you can see, some of the references don't have a path to a dll to reference. How do i reference those?

  • *Gurus*
Posted
That's not how COM works. GUID's are used instead of paths. If the DLL's the GUID's are looking for are not present the application will not compile. What you need to do is ensure that the required libraries (DLL's) are registered on the machine prior to compilation.
Posted
That's not how COM works. GUID's are used instead of paths. If the DLL's the GUID's are looking for are not present the application will not compile. What you need to do is ensure that the required libraries (DLL's) are registered on the machine prior to compilation.

 

I understand this. Let me restate my problem..

 

The .csproj file contains the references. The COM objects use the GUID instead of paths (like you said). But! To compile at command line, you need to specify the references via the /r or /reference parameter. What do i put for these COM references? The normal dll's are easy. You just use:

 /reference:c:\winnt\system.dll

 

But what do I use for the COM references? I can't do:

/reference:{ASDFD-ASDFA-DSDAF-ASDFFDA}

 

Is there a way to retrive the dll path for the COM objects then?

  • *Gurus*
Posted
Visual Studio .NET automatically creates a Runtime Callable Wrapper (RCW) for each COM object. You'll need to do the same using the Type Library Importer (Tlbimp.exe) installed along with the .NET Framework SDK (and Visual Studio .NET). Once the wrapper is generated you'll reference it instead.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...