473,320 Members | 1,982 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,320 software developers and data experts.

An Assembly can include several .exe files?

right?
Jan 1 '06 #1
5 5052
Nice,

No, it can't. It can include several modules, but not several EXE
files. After all, it's one file, which can be of type exe or DLL.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Nice" <Ni**@discussions.microsoft.com> wrote in message
news:4D**********************************@microsof t.com...
right?

Jan 1 '06 #2

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:O5**************@TK2MSFTNGP14.phx.gbl...
Nice,

No, it can't. It can include several modules, but not several EXE
files. After all, it's one file, which can be of type exe or DLL.

Hope this helps.


An assembly can contain many files. As far as I know, only one of them can
be of type .DLL or .EXE. And I'm not sure if it's required that there be
either an EXE or DLL: can any other type of file contain the assembly
manifest?
Jan 1 '06 #3
Mike,

An assembly can contain many modules. Ultimately though, an assembly is
ONE file, with ONE manifest.

A module is not an EXE or a DLL, it is a module, very different.

Big difference.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mike Schilling" <ms*************@hotmail.com> wrote in message
news:OM**************@TK2MSFTNGP09.phx.gbl...

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:O5**************@TK2MSFTNGP14.phx.gbl...
Nice,

No, it can't. It can include several modules, but not several EXE
files. After all, it's one file, which can be of type exe or DLL.

Hope this helps.


An assembly can contain many files. As far as I know, only one of them
can be of type .DLL or .EXE. And I'm not sure if it's required that there
be either an EXE or DLL: can any other type of file contain the assembly
manifest?

Jan 1 '06 #4

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uQ**************@TK2MSFTNGP09.phx.gbl...
Mike,

An assembly can contain many modules. Ultimately though, an assembly
is ONE file, with ONE manifest.


No, that's not true. (Well, the one manifest part is true.)

See, for instance, http://www.dnzone.com/ShowDetail.asp?NewsId=698, which
says

What is an assembly?
* An Assembly is a logical unit of code
* One assembly can contain one or more files :

There is one *main* file in as assembly, the one that contains the assembly
manifest. But it can refer to an arbitrary number of other files, all of
which are part of the assembly. To see this, do the following:

Link some C# classes into a module. It doesn't really matter what's in
them.

Link the following class into an executable, adding in the module created in
the previous step: (The command line looks like
"csc /addmodule:Package.netmodule Hello.cs" )

using System;
using System.IO;
using System.Reflection;

class Hello {
public static void Main()
{
try {
Assembly assm = Assembly.GetAssembly(typeof(Hello));
FileStream[] files = assm.GetFiles();
Console.WriteLine("" + files.Length + " files in assembly");
foreach (FileStream f in files) {
Console.WriteLine(f.Name);
}
}
catch (Exception ex) {
Console.WriteLine(ex);
}
}
}

Run it. You'll see output like:

2 files in assembly
c:\csharp\Hello.exe
c:\csharp\package.netmodule

Now delete the file containing the module. Try to run the executable again,
and you'll see an error like:
System.IO.FileNotFoundException: File or assembly name Package.netmodule,
or one
of its dependencies, was not found.
File name: "Package.netmodule"
at System.Reflection.Assembly.nGetModules(Boolean loadIfNotFound,
Boolean getResourceModules)
at System.Reflection.Assembly.GetFiles(Boolean getResourceModules)
at System.Reflection.Assembly.GetFiles()
at Hello.Main()

The error being that one of the assembly's files is missing.

Jan 2 '06 #5

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uQ**************@TK2MSFTNGP09.phx.gbl...
Mike,

An assembly can contain many modules. Ultimately though, an assembly
is ONE file, with ONE manifest.

A module is not an EXE or a DLL, it is a module, very different.

Big difference.

Nick,
Mike is right.

An assembly can span multiple modules AND multiple files, the file is just a
container for a module or a number of modules, the extention DLL or EXE is a
non issue here, you can take anything you like as an extention even for the
main assembly file.

Try this:
// m1.cs
using System;
class Tester
{
static void Main()
{
C c = new C();
c.Run();
}
}

// m2.cs
using System;
public class C
{
public void Run()
{
Console.WriteLine("Hello from m2");
}
}

//build m2 an create output module m2.dll
csc /t:module /out:m2.dll m2.cs
// add m2 to assembly
csc /addmodule:m2.dll m1.cs

Now you have a multifile assembly consisting of m1.exe and m2.dll. m1
contains the assembly manifest for m1 and m2.

Note that you can even do this :
csc /addmodule:m2.dll /out:m1.whatever m1.cs
and run it as m1.whatever

Willy.

Jan 2 '06 #6

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

Similar topics

3
by: Madhav Desetty | last post by:
I have a legacy C/C++ header file which I use to set the version for DLLs thru' the .rc files while compiling legacy DLLs every day. I update this header file for every build and would like to use...
2
by: Donal McWeeney | last post by:
Hi, Are there any good guidance white papers out there on the best way to design and build assemblys in VS.Net that would cover the following questions I have and requirements I know of: The...
2
by: George Durzi | last post by:
I have a dll that I use in several projects, that I placed in the Global Assembly Cache. This dll is references in each of my projects. This Dll is referenced by a type= declaration in my...
10
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read...
5
by: Rich | last post by:
Hello, So I develop a vb.net exe on my (win2k) workstation. I have to deploy it to another workstation (actually several - all win2k). Each receiving workstation will have .Net Framework 1.1...
12
by: Steven Berkovitz | last post by:
I have several ASP.NET applications with near identical web.config files. In one of them I am successfuly able to bind to an assembly while on others I am not. All of them have the following...
3
by: dfranzen | last post by:
Hi *, I'm in the process of porting an ANSI C++ project from a UNIX platform to .NET. After "getting rid of" some platform-specific stuff I managed to compile the first two libraries into mixed...
12
by: TC | last post by:
I'm trying to figure out what the "Friend" keyword does. I know it specifies that "elements are accessible from within the same assembly", but that doesn't help because I don't know what an...
10
by: =?Utf-8?B?SmFtZXMgV29uZw==?= | last post by:
Hi everybody, I'm trying to use the new VB 2008 right now and I want to know how to preset the company name and copyright informtion in Assembly Information. In my current VB 2005, company name...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.