473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 "compilation units"?

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

<Solution>
<ApplicationProject what='Will produce Application.exe'>
<DefaultNamespace>Application</DefaultNamespace>
<Reference>Application.dll</Reference>
<MainFormClass>
namespace Application.ui
{
public class MainForm: Form
{
private void InitializeComponents()
{
//load a SuperControl from the Framework assembly
superControl = new
Application.Forms.SuperControl();
}
}
</MainFormClass>
</ApplicationProject>

<FrameworkProject what='Will produce Application.dll'>
<DefaultNamespace>Application</DefaultNamespace>
<SuperControlClass>
namespace Application.Forms
{
public class SuperControl : UserControl
{
}
}
</SuperControlClass>

</FrameworkProject>

</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 "Application" 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 2078
<pe*******@hotmail.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 "compilation 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 "Application" 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.com>
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
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...
2
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...
9
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"...
2
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...
0
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...
0
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...
0
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:...
3
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...
1
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...
8
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...

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.