Question about assembly info in C#


P

Paul

Hi,

I have experience in Java and C++ but I am rather new to C# and just
started learning it. I am using Visual C# 2005 Express Edition and I
found that there is a file called "AssemblyInfo.cs", which is something
like I attached below. Would anyone please let me know what is the
purpose of this file? Or are there any equivalent stuff I can imagine
in C++ or Java?

Thanks a lot.
Paul

----------------------------
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the
following
// set of attributes. Change these attribute values to modify the
information
// associated with an assembly.
[assembly: AssemblyTitle("BasicTest1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("paul2")]
[assembly: AssemblyProduct("BasicTest1")]
[assembly: AssemblyCopyright("Copyright © paul2 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not
visible
// to COM components. If you need to access a type in this assembly
from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is
exposed to COM
[assembly: Guid("c1dc9d39-85e1-47fc-975d-28d982cd2174")]

// Version information for an assembly consists of the following four
values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
 
Ad

Advertisements

D

Dave Sexton

Hi Paul,

"AssemblyInfo.cs" is a normal C# file (.cs) that is created by VS 2005 when you create a new
project. It's purpose is to encapsulate assembly-level attributes, which provide meta-data for your
compiled assembly.

// C# using directive adds the specified namespace to the file's scope
// so you can code "MethodInfo" in this file, for instance, without having to
// qualify it with a namespace: System.Reflection.MethodInfo.
// (Note: The using statement (different) can be used to ensure
// the disposal of objects that implement the IDisposable interface just
// like you would using try..finally in a method body, but here is a directive).
using System.Reflection;

// AssemblyTitleAttribute (the Attribute part can be left off in C# when the
// class is being used between [] characters) is being used on the Assembly
// as meta-data.
// "assembly:" applies the AssemblyTitleAttribute to the assembly in which
// AssemblyInfo.cs will be compiled.
// The title given for the Assembly is "BasicTest1". This is just meta-data,
// which isn't used by the CLR.
[assembly: AssemblyTitle("BasicTest1")]

The rest of the statements are also just Attributes being used for assembly-level meta-data. Check
out the MSDN docs for each one for more information (don't forget to search for the name used here
and Attribute (e.g., GuidAttribute).

"Attributes (C# Programming Guide)"
http://msdn2.microsoft.com/en-us/library/z0w1kczw.aspx

"C# using Directive"
http://msdn2.microsoft.com/en-gb/library/sf0df423.aspx

"C# using Statement"
http://msdn2.microsoft.com/en-gb/library/yh598w02.aspx

--
Dave Sexton

Hi,

I have experience in Java and C++ but I am rather new to C# and just
started learning it. I am using Visual C# 2005 Express Edition and I
found that there is a file called "AssemblyInfo.cs", which is something
like I attached below. Would anyone please let me know what is the
purpose of this file? Or are there any equivalent stuff I can imagine
in C++ or Java?

Thanks a lot.
Paul

----------------------------
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the
following
// set of attributes. Change these attribute values to modify the
information
// associated with an assembly.
[assembly: AssemblyTitle("BasicTest1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("paul2")]
[assembly: AssemblyProduct("BasicTest1")]
[assembly: AssemblyCopyright("Copyright © paul2 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not
visible
// to COM components. If you need to access a type in this assembly
from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is
exposed to COM
[assembly: Guid("c1dc9d39-85e1-47fc-975d-28d982cd2174")]

// Version information for an assembly consists of the following four
values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
 
Ad

Advertisements

?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Paul said:
I have experience in Java and C++ but I am rather new to C# and just
started learning it. I am using Visual C# 2005 Express Edition and I
found that there is a file called "AssemblyInfo.cs", which is something
like I attached below. Would anyone please let me know what is the
purpose of this file? Or are there any equivalent stuff I can imagine
in C++ or Java?

Consider it equivalent to the manifest in a jar file.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top