473,915 Members | 5,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Same namespace in EXE and dll

I´m currently writing an application that will have some plugin
functionality and therefor I´ve created two projects one that will
build the exe and one that contains the "framework" for the application
as a dll, which also contains reusable controls that the application
and "plugin developers" use.

I was suprised that I couldn´t load a control in my dll assembly from
my application. This worked before I decided to have the same top
namespace in both application and assembly. Is there a problem with
having a namespace duplicated over (I´m not sure what the correct term
is) several "compilatio n units"?

In case it will help I´ll add the project structure

<Solution>
<ApplicationPro ject what='Will produce Application.exe '>
<DefaultNamespa ce>Application</DefaultNamespac e>
<Reference>Appl ication.dll</Reference>
<MainFormClas s>
namespace Application.ui
{
public class MainForm: Form
{
private void InitializeCompo nents()
{
//load a SuperControl from the Framework assembly
superControl = new
Application.For ms.SuperControl ();
}
}
</MainFormClass>
</ApplicationProj ect>

<FrameworkProje ct what='Will produce Application.dll '>
<DefaultNamespa ce>Application</DefaultNamespac e>
<SuperControlCl ass>
namespace Application.For ms
{
public class SuperControl : UserControl
{
}
}
</SuperControlCla ss>

</FrameworkProjec t>

</Solution>

.....
I just tried renaming my assembly dll to a different name and it worked
so the above question becomes void. So it appears that if your
application is Application.exe and you try to load controls from a
Application.dll assembly it won't work. Is there a reason for that? (It
looks like, eventhough I add Application.dll as a reference, it only
tries to load the control from Application.exe . I get a feeling the
reference is just stored as "Applicatio n" and when it's time to load
the reference the "virtual machine" will find Application.exe before
Application.dll and be satisfied with that)

Jan 31 '06 #1
1 2098
<pe*******@hotm ail.com> wrote:
I´m currently writing an application that will have some plugin
functionality and therefor I´ve created two projects one that will
build the exe and one that contains the "framework" for the application
as a dll, which also contains reusable controls that the application
and "plugin developers" use.

I was suprised that I couldn´t load a control in my dll assembly from
my application. This worked before I decided to have the same top
namespace in both application and assembly. Is there a problem with
having a namespace duplicated over (I´m not sure what the correct term
is) several "compilatio n units"?
Namespaces themselves should be irrelevant here.

<snip>
I just tried renaming my assembly dll to a different name and it worked
so the above question becomes void. So it appears that if your
application is Application.exe and you try to load controls from a
Application.dll assembly it won't work. Is there a reason for that? (It
looks like, eventhough I add Application.dll as a reference, it only
tries to load the control from Application.exe . I get a feeling the
reference is just stored as "Applicatio n" and when it's time to load
the reference the "virtual machine" will find Application.exe before
Application.dll and be satisfied with that)


Yes, that's probably the problem. However, your assembly doesn't need
to be named after the namespaces it contains. I'd name the application
exe file after the application itself, and then have separate plugin
assemblies with different names.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 31 '06 #2

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

Similar topics

1
2241
by: Steve George | last post by:
Hi, I have a scenario where I have a master schema that defines a number of complex and simple types. I then have a number of other schemas (with different namespaces) where I would like to reuse some of these master complex and simple types. This I believe will assist me in transforming between the master schema and the other smaller schemas that contain a subset of the elements in the master schema. I understand that I can import an...
2
2196
by: Che | last post by:
Greetings, I am writing an application that uses an extendible XML file. in order to validate that XML I use a main XSD and in additional - few more extensions XSD's that uses the types in the main XSD as base types. my clients can define their own XSD's extensions and use my generic application to process their XML's. The problem:
9
1460
by: David Thielen | last post by:
Hi; This concerns Excel's SpreadsheetML format and how Excel writes it. Excel saves an xml file as follows: <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
2
10772
by: Chi Tang | last post by:
Hi, I have 2 questions: How to call a class member function from another class and these 2 classes are in the same namespace? Also, how to use another project's dialog box and this 2 projects are in the same VS.NET solution?
0
1310
by: Tressa | last post by:
Sorry to be such a novice about this but..... I have a windows service. It contains two separate files. Both have the same namespace name. I need to pass "bDisplay" into the other file. I am getting several errors and not sure why or how to solve them does anyone have any help? How do I access the other file? ServerSocket.cs *This is where the main server start is so the" private bool m_bIsDisplayed = false;" had to go here so it...
0
1409
by: rob | last post by:
I have two projects (dlltest, dll2) both creating a dll. The two dlls define classes (dll1, dll2) within the same namespace (MyNamespace). One of the dlls (dlltest) is using functionality of the other dll (dll2). Also both dlls use the same enum (MyEnum) defined in a header file (common.h). This header file is included in both dlls. Now I have one function from the first dll (dlltest) return the return argument from the second dll...
0
1090
by: Don | last post by:
I have 2 web user controls (.ascx) with the same name that are in in different namespaces. When I try to put both controls on the same page I get the following runtime error: BC30560: 'searchCriteria_ascx' is ambiguous in the namespace 'ASP'. The register tag on the page shows that both controls have the same tagName but different tagPrefixes. -------------
3
1323
by: tuanhoanganh | last post by:
My program has class's name same namespace 's name. Ex namespace clsvoucher public class clsvoucher .......... end class end namespace Can I use Dim a as clsvoucher or I must use Dim a as clsvourcher.clsvourcher ? Thank. Sorry for my english
1
1648
by: ThunderMusic | last post by:
Hi, I have many classes a user may need to call methods on my webservice. Some classes are "published" and some are not... I mean, when we do a Web reference from another project, we don't have access to some classes remotely... Is there something special these classes need so we can use them remotely? There's an example at the end of the post Here, Result is accessible, but ContactData is not... and there are others
8
1905
by: Jack | last post by:
Hi, I have a single class XXX residing in a namspace with the same name: XXX. I can access my class in my code just fine with: XXX.XXX.MySub() '(Note: shared sub!) But I don't want to clutter the code with the namespace every time I access my class.
0
10039
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
9881
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
11354
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
10542
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9732
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...
1
8100
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7256
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4778
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
3
3368
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.