473,700 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

An Assembly can include several .exe files?

right?
Jan 1 '06 #1
5 5063
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.co m

"Nice" <Ni**@discussio ns.microsoft.co m> wrote in message
news:4D******** *************** ***********@mic rosoft.com...
right?

Jan 1 '06 #2

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:O5******** ******@TK2MSFTN GP14.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.co m

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

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in message news:O5******** ******@TK2MSFTN GP14.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.c om> wrote in
message news:uQ******** ******@TK2MSFTN GP09.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:Packa ge.netmodule Hello.cs" )

using System;
using System.IO;
using System.Reflecti on;

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

Run it. You'll see output like:

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

Now delete the file containing the module. Try to run the executable again,
and you'll see an error like:
System.IO.FileN otFoundExceptio n: File or assembly name Package.netmodu le,
or one
of its dependencies, was not found.
File name: "Package.netmod ule"
at System.Reflecti on.Assembly.nGe tModules(Boolea n loadIfNotFound,
Boolean getResourceModu les)
at System.Reflecti on.Assembly.Get Files(Boolean getResourceModu les)
at System.Reflecti on.Assembly.Get Files()
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.c om> wrote in
message news:uQ******** ******@TK2MSFTN GP09.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.WriteLi ne("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.dl l 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.dl l /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
8240
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 the constants I defined in this header file for the .NET projects AssemblyInfo.cs file instead of updating the AssemblyInfo.cs for every build. Below I came up with a strategy to use the legacy header file but it is not working. Contents of...
2
1834
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 assembly(s) I build must be installed in the GAC. My assembly(s) needs to include the following: - my own class/utility librarary code
2
1732
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 web.config as follows. <configSections> <section name="exceptionManagement" type="Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManagerSectio nHandler,Microsoft.ApplicationBlocks.ExceptionManagement" /> </configSections>
10
3454
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 somewhere that each folder under the "web site" is compiled in separate assembly. I however, did not find that the "web site" creation in vs.net 2005 created any AssemblyInfo.cs file.
5
1914
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 (or higher). I place the vb.net exe on the workstation. In vb6 I used to have to run setup if there were any fancy controls on the vb6 exe. So, in order to correctly deploy a vb.net exe what all is involved besides having .Net Framework on each...
12
3268
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 qualifiers: <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <qualifyAssembly partialName="OrderDynamics.ImageService.Interfaces"...
3
3955
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 assemlies (DLLs) using MSVC8 (VS2005) with the /clr option. However, I get hundreds of linker errors (mostly LNK2028) because assembly B uses native types defined in assembly A. I could easily get rid of the problem by #including the original source...
12
1969
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 assembly is. I know what a project is, and I know what a solution is, but "assembly" isn't defined in the help file anywhere. Can anyone provide a simple definition?
10
9672
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 and copyright information (the word "CopyRight" with company name and year) is filled in automatically once a new project is created. However, I have no idea where I can configurate it in my new VB 2008. Thanks for your kindly advice!
0
8718
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
8642
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
9206
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...
1
8963
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5899
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();...
0
4400
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...
0
4652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3083
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
2022
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.