Bugs item #1314179, was opened at 2005-10-05 13:00
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1314179&group_id=31650

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core
Group: 0.85
Status: Open
Resolution: None
Priority: 5
Submitted By: Daniel Bowen (daniel_bowen)
Assigned to: Nobody/Anonymous (nobody)
Summary: Incorrect reference to non-default type library in DLL

Initial Comment:
It appears that if you add a reference in a .NET project 
to a COM type library that is not the first or default type 
library for a DLL that the incorrect type library is 
referenced when generating an interop assembly.

For an example, create a new c# project in Visual 
Studio .NET 2003.  Right click on "References" under 
the project node in the solution explorer.  Select "Add 
Reference".  From the COM tab, 
choose "NetFwTypeLib", which is the type library 3 in 
hnetcfg.dll.  Add the following code to a class:

using NetFwTypeLib;
...
Type fwType = Type.GetTypeFromProgID
("HNetCfg.FwMgr", false); 
INetFwMgr fwMgr = (INetFwMgr)Activator.CreateInstance
(fwType);

This will build fine if you build the solution through 
Visual Studio .NET 2003.  However, if you run it through 
Nant, it fails with the error:

"error CS0246: The type or namespace 
name 'INetFwMgr' could not be found (are you missing a 
using directive or an assembly reference?)"

If you use ildasm to view the interop assembly 
generated by Visual Studio.NET 2003 and the one 
generated by Nant, you can see that Nant generated an 
interop assembly for the first type library in hnetcfg.dll, 
not type library 3.  You can see that NetFwTypeLib has 
the GUID {58FBCF7C-E7A9-467C-80B3-
FC65E8FCCA08}.  In HKCR\TypeLib\{58FBCF7C-E7A9-
467C-80B3-FC65E8FCCA08}\1.0\0\win32 you can see 
the default value (with the location of the DLL) is 
C:\WINDOWS\system32\hnetcfg.dll\3  (or slightly 
different, based on the location of your Windows 
directory).

Thanks,
-Daniel

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1314179&group_id=31650


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to