By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,937 Members | 2,447 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,937 IT Pros & Developers. It's quick & easy.

Question about assembly info in C#

P: n/a
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")]

Nov 19 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

"Paul" <pl*****@gmail.comwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
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")]
Nov 19 '06 #2

P: n/a
Paul wrote:
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
Nov 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.