473,699 Members | 2,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exposing a .Net assembly to both VB6 and .Net (1 more time)

I am finally able to call my .Net object from a VB6 project (see posting
'Calling VB.Net classes from VB6', thanks to the reference Tony gave me to:
article:http://msdn.microsoft.com/msdnmag/is...p/default.aspx

The next step was to see if I could still use the assembly in a .Net
application. I added another project to the original solution was was able
to create a reference to it through the projects tab, no problems so far.

I compiled the project with a strong signature and used the gacutil to place
it in the GAC. I verified with Windows explorer that it was there, and again
no problems.

I then created a new .Net project and tried to add a reference to it (from
the .Net tab) and it was not there! grrrr It was on the Com tab, so I tried
to ad the reference to it and got the following error message:

"A reference to 'Test Class' could not be added.

The ActiveX type library C:...\TestClass .tlb' was exported from a .Net
assembly and can not be added as a reference.

Add a reference to the .Net assembly instead."

BUT THE ASSEMBLY IS NOT LISTED ON THE .NET TAB!!!!

Ok, what to do now? Shouldn't I be able to share this assembly with several
..Net projects w/o including a local copy of it into each one?
--
Terry
Jun 2 '06 #1
2 9884
Terry,

The reason you can not see your DLL in the ".NET" tab is becasue the tab
does not reference the Global Assembly Cache. The files that you see in
there are copies of what is in the Global Assembly Cache located in other
locations. Look at the "Path" column of the ".NET" tab and you will see that
the assemblies in that list are not located in "C:\Windows\Ass embly", but in
other places "C:\Windows\Mic rosoft .NET\Framework\ ".

The Global Assembly Cache is not a development feature, but a deployment
feature. When an assembly looks for a referenced DLL, it searches for it in
the following order:

1. Checks the assembly name to see if it is already bound. If so, then use
that one.
2. Checks the Global Assembly Cache.
3. Searches the app.config, machine.config, etc. for the location of the
referenced DLL.
4. Checks the application directory.

So what you should probably do is in your new Solution, you can either add
the Project or reference the *.DLL directly by browsing for it. Then, when
you deploy your new solution, if you place your .NET dll in the GAC, you new
solution will find it, as long as it was build with the same version number.

Hope this helps.

"Terry" wrote:
I am finally able to call my .Net object from a VB6 project (see posting
'Calling VB.Net classes from VB6', thanks to the reference Tony gave me to:
article:http://msdn.microsoft.com/msdnmag/is...p/default.aspx

The next step was to see if I could still use the assembly in a .Net
application. I added another project to the original solution was was able
to create a reference to it through the projects tab, no problems so far.

I compiled the project with a strong signature and used the gacutil to place
it in the GAC. I verified with Windows explorer that it was there, and again
no problems.

I then created a new .Net project and tried to add a reference to it (from
the .Net tab) and it was not there! grrrr It was on the Com tab, so I tried
to ad the reference to it and got the following error message:

"A reference to 'Test Class' could not be added.

The ActiveX type library C:...\TestClass .tlb' was exported from a .Net
assembly and can not be added as a reference.

Add a reference to the .Net assembly instead."

BUT THE ASSEMBLY IS NOT LISTED ON THE .NET TAB!!!!

Ok, what to do now? Shouldn't I be able to share this assembly with several
.Net projects w/o including a local copy of it into each one?
--
Terry

Jun 4 '06 #2

Thank you rmacias again for your input.

Hi Terry,

As I described in the other thread that you've posted, the exposed COM
component from .NET using ComClassAttribu te is not a true COM component.
When you want to use it from another .NET assembly, simply reference to it
as normal .NET assembly.

I totally agree with rmacias about the Visual Studio IDE reference tab and
the Global Assembly Cache. You can refer to MSDN for more info:

#Add Reference Dialog Box
http://msdn2.microsoft.com/en-us/library/ftcwa60a.aspx

Have a nice day!
Regards,
Walter Wang
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4669
by: Stefan Behnel | last post by:
Hi! The logging module nicely prepends each line with a formatted date. However, I'm not interested in the actual date but only in the number of milliseconds that passed since the start of the program. What is the best way of doing that? Thanks, Stefan
1
1942
by: asj | last post by:
Just when I say web services may be hyped, here comes a news report that says Swedish Referendum Results will be delivered in real time over the internet using Java web services. In one sense, exposing the real-time results as a web service is sorta cool, since other apps can tie in to it and distribute the info to multiple targets. n the other hand, wouldn't deploying the information via HTML be easier for the majority of people who...
1
376
by: Chris Dunaway | last post by:
I'm using the ICodeCompiler.CompileAssemblyFromSource method to compile a VB class dynamically. The problem is that when I create an instance of the resulting class, it loads the assembly. If I have to execute this section of code more than once, it loads the dynamic assembly each time so that I end up with more than one of these assemblies in memory. To unload the assembly, I found I must create another AppDomain but the AppDomain...
1
2033
by: Microsoft | last post by:
Hi all, I have some application which dynamically loads a module as a DLL Assembly. Both are written in C#. I also would like to be able to dynamically unload this assembly (i.e. to update the module with a newer version). How can I do that ? I used this code to load the module : // create instance for module
2
1475
by: Cornu Nicolas | last post by:
Hello, The above code generate the above error. The not found assembly is different at each execution. -------------------------------------------------------------------------- public void WritePatchConfiguration(StreamWriter wr) { System.Xml.Serialization.XmlSerializer writer = new XmlSerializer(this.GetType());
2
1208
by: Boni | last post by:
Dear All, Dear Tomas (My feeling is that you could like this for me very complicated question). I want at the run time resolve one of the added reference assemblies, but the approach fails. fuslogvw shows, that TypeAddedToReferencesButNotInTheRightPath couldn't be found, even before the message box pops up. Did I missed somethig? I found (http://www.codeproject.com/dotnet/loadpoly.asp), which seems to do quite the same. Why CLR tries to...
2
1543
by: Raghu | last post by:
(Sorry for cross post but kinda in a hurry) I have com+ server applicaiton on machine A. The exported application proxy is installed on machine B. Both machines have windows 2003 os. Both machines are configured to be application servers. I created on machine B: 1) A vbs file 2) VB.NET assembly Both create the same component using CreateObject on machine B as shown
2
1854
by: Boni | last post by:
Dear all, I created a mixed mode exe assembly. Now I try to load a class from this assembly within the VB project. I get following error: Unhandled Exception: System.IO.FileLoadException: Attempt to load an unverifiabl e executable with fixups (IAT with more than 2 sections or a TLS section.) (Exce ption from HRESULT: 0x80131019) at ConsoleApplication1.Module1.Main()
2
1230
by: Andy Jump | last post by:
Howdy all, I have a Sql Server Assembly that contains some Clr stored procs for some of the more complex operations I wish to perform. When the number of these stored procs is low then the assembly deploys nice and quickly but as the number rises the deploy time begins to take a huge amount of time. Deployment took over 20 minutes for 167 stored procs. I have done some checking and monitoring and found that it seems to be
3
2173
by: Peter | last post by:
Hi I can create types from dynamic loaaded assemblies (Assembly.Load) with Assembly.GetTyp( <typename) - OK I need a reference to the assembly (just Type.GetType() do not work ) now my question. 1) If i need different Types/Objects of the same Assembly in different app.sections, should I use Assembly.Load() several times or shoud I
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8613
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7745
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4374
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.