473,474 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Same class existing in multiple assemblies

Hi All,

I have a class Transaction in 2 different assemblies having different
namespaces totally.

I have an ASP.Net(1.1) page. In the codebehind .cs file I
references/imports one of those assemblies in using statement and use
the class from that assembly.

However this page gives compilation error as it automatically gets the
definition of this class from the other assembly which is different.

I am not referring to that assemly in any way.

I am using .Net framework 1.1

Why does the framework not use the assembly specified in the codebehind
file and associate the class with the other assembly? It even does not
give a 'Class defined in multiple places' error. Also the namespaces
are entirely different

Piyush

Oct 31 '06 #1
5 2729
Hi Piyush,

The namespace does not matter if you simply use Transaction in your code..
If the compiler gets confused when it finds Transaction in more than one
namespace it will give you a namespace conflict message. You say that you
get no such message so chances are the error is of another type. What
exactly is the error message?

You can always use the full name of the class including namespace or
create an alias

using MyTransaction = Namespace.Transaction;
On Tue, 31 Oct 2006 12:31:35 +0100, <bh*********@gmail.comwrote:
Hi All,

I have a class Transaction in 2 different assemblies having different
namespaces totally.

I have an ASP.Net(1.1) page. In the codebehind .cs file I
references/imports one of those assemblies in using statement and use
the class from that assembly.

However this page gives compilation error as it automatically gets the
definition of this class from the other assembly which is different.

I am not referring to that assemly in any way.

I am using .Net framework 1.1

Why does the framework not use the assembly specified in the codebehind
file and associate the class with the other assembly? It even does not
give a 'Class defined in multiple places' error. Also the namespaces
are entirely different

Piyush


--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 31 '06 #2
The page gives a compilation error saying that a property does not
exist
Transaction.InstitutionId does not exist

When I use the following as suggested by you
using MyTransaction = Namespace.Transaction;
it gives me an compilation error saying 'Transaction is already
defined' whereas I don't use that dll at all

Regards
Piyush

Morten Wennevik wrote:
Hi Piyush,

The namespace does not matter if you simply use Transaction in your code.
If the compiler gets confused when it finds Transaction in more than one
namespace it will give you a namespace conflict message. You say that you
get no such message so chances are the error is of another type. What
exactly is the error message?

You can always use the full name of the class including namespace or
create an alias

using MyTransaction = Namespace.Transaction;
On Tue, 31 Oct 2006 12:31:35 +0100, <bh*********@gmail.comwrote:
Hi All,

I have a class Transaction in 2 different assemblies having different
namespaces totally.

I have an ASP.Net(1.1) page. In the codebehind .cs file I
references/imports one of those assemblies in using statement and use
the class from that assembly.

However this page gives compilation error as it automatically gets the
definition of this class from the other assembly which is different.

I am not referring to that assemly in any way.

I am using .Net framework 1.1

Why does the framework not use the assembly specified in the codebehind
file and associate the class with the other assembly? It even does not
give a 'Class defined in multiple places' error. Also the namespaces
are entirely different

Piyush

--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 31 '06 #3
If I remembered correctly, the alias feature is introduced in .Net 2.0,
while the OP are using the .Net 1.1.

Morten Wennevik wrote:
Hi Piyush,

The namespace does not matter if you simply use Transaction in your
code. If the compiler gets confused when it finds Transaction in more
than one namespace it will give you a namespace conflict message. You
say that you get no such message so chances are the error is of another
type. What exactly is the error message?

You can always use the full name of the class including namespace or
create an alias

using MyTransaction = Namespace.Transaction;
On Tue, 31 Oct 2006 12:31:35 +0100, <bh*********@gmail.comwrote:
>Hi All,

I have a class Transaction in 2 different assemblies having different
namespaces totally.

I have an ASP.Net(1.1) page. In the codebehind .cs file I
references/imports one of those assemblies in using statement and use
the class from that assembly.

However this page gives compilation error as it automatically gets the
definition of this class from the other assembly which is different.

I am not referring to that assemly in any way.

I am using .Net framework 1.1

Why does the framework not use the assembly specified in the codebehind
file and associate the class with the other assembly? It even does not
give a 'Class defined in multiple places' error. Also the namespaces
are entirely different

Piyush

--Happy Coding!
Morten Wennevik [C# MVP]
Oct 31 '06 #4
You need use the full name including the namespace , like
NameSpace1.ClassA, NameSpace2.Class A ...

bh*********@gmail.com wrote:
The page gives a compilation error saying that a property does not
exist
Transaction.InstitutionId does not exist

When I use the following as suggested by you
using MyTransaction = Namespace.Transaction;
it gives me an compilation error saying 'Transaction is already
defined' whereas I don't use that dll at all

Regards
Piyush

Morten Wennevik wrote:
>Hi Piyush,

The namespace does not matter if you simply use Transaction in your code.
If the compiler gets confused when it finds Transaction in more than one
namespace it will give you a namespace conflict message. You say that you
get no such message so chances are the error is of another type. What
exactly is the error message?

You can always use the full name of the class including namespace or
create an alias

using MyTransaction = Namespace.Transaction;
On Tue, 31 Oct 2006 12:31:35 +0100, <bh*********@gmail.comwrote:
>>Hi All,

I have a class Transaction in 2 different assemblies having different
namespaces totally.

I have an ASP.Net(1.1) page. In the codebehind .cs file I
references/imports one of those assemblies in using statement and use
the class from that assembly.

However this page gives compilation error as it automatically gets the
definition of this class from the other assembly which is different.

I am not referring to that assemly in any way.

I am using .Net framework 1.1

Why does the framework not use the assembly specified in the codebehind
file and associate the class with the other assembly? It even does not
give a 'Class defined in multiple places' error. Also the namespaces
are entirely different

Piyush


--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 31 '06 #5
I'm afraid you remember wrong. Alias has been around for a while.
On Tue, 31 Oct 2006 13:54:11 +0100, Jianwei Sun <js***********@gmail.com
wrote:
If I remembered correctly, the alias feature is introduced in .Net 2.0,
while the OP are using the .Net 1.1.

Morten Wennevik wrote:
>Hi Piyush,
The namespace does not matter if you simply use Transaction in your
code. If the compiler gets confused when it finds Transaction in more
than one namespace it will give you a namespace conflict message. You
say that you get no such message so chances are the error is of another
type. What exactly is the error message?
You can always use the full name of the class including namespace or
create an alias
using MyTransaction = Namespace.Transaction;
On Tue, 31 Oct 2006 12:31:35 +0100, <bh*********@gmail.comwrote:
>>Hi All,

I have a class Transaction in 2 different assemblies having different
namespaces totally.

I have an ASP.Net(1.1) page. In the codebehind .cs file I
references/imports one of those assemblies in using statement and use
the class from that assembly.

However this page gives compilation error as it automatically gets the
definition of this class from the other assembly which is different.

I am not referring to that assemly in any way.

I am using .Net framework 1.1

Why does the framework not use the assembly specified in the codebehind
file and associate the class with the other assembly? It even does not
give a 'Class defined in multiple places' error. Also the namespaces
are entirely different

Piyush
--Happy Coding!
Morten Wennevik [C# MVP]


--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 31 '06 #6

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

Similar topics

2
by: pieter.breed | last post by:
Hi All, The company I work for has traditionally used COM/ActiveX for the solutions that it provides. We are in the process of moving to .NET and a few applications have been written in VB.NET...
5
by: Edward Mitchell | last post by:
I am trying to include two class files into a web service project. The structure I have is a top level solution and project in a folder and below that, the web service project in it's own folder. ...
4
by: don | last post by:
I have two existing interfaces having methods with same names. Now I have to implement both intrfaces in one class. Is there any way I could implement methods with same names in both interfaces...
6
by: Plamen Doykov | last post by:
Hi all I have converted a simple project from ASP.NET 1 to 2.0 with the latest prerelease of Visual Studio 2005. The problem is I can't access internal members from the code behind. It gives:...
2
by: Brian Henry | last post by:
is there any way to make an assembly file accessable across multiple projects (we have over 20 that need the info all to be the same at build version, title, desc, copyright,etc) i saw MS did this...
13
by: Brian | last post by:
I have many similar classes in a project, one for each type of report my app can create. I want to instantiate them based on a value passed in by a scheduler module. Right now I have Sub...
8
by: Born Bugler | last post by:
What I'm actually talking about is, when you put the same class in different assemblies, you get two different types. This is reasonable (if you would call it) in most cases as it avoids possible...
4
by: Steve Baer | last post by:
I've already tested this with C# and it works, but I'm being paranoid and I wanted to also check here. Our application has a large class library written in C++/CLI for plug-in projects. The...
7
by: WTH | last post by:
I am now aware (I am primarily a C++ developer) that in C# if you reference the same interface from the same file in two different projects the types are actually incompatible. I found this out...
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.