How to read AssemblyInfo.cs ?


G

Guest

I'm using dotnetframework 1.1.
By the way, I don't know how to read the information of AssemblyInfo.cs file.
I wish to read it.

The following Example Files.

File 1: AssemblyInfo.cs

using System.Reflection;
using System.Runtime.CompilerServices;

[assembly: AssemblyTitle("C#")]
[assembly: AssemblyDescription("C# language")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("1.1.0.1913")]

[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]

File2 : AssemblyInfoReading.cs

using System;
using System.Reflection;

class Class1
{
public static void Main()
{
Assembly SampleAssembly;
// You must supply a valid fully qualified assembly name here.

SampleAssembly = Assembly.Load("Assembly text name, Version,
Culture, PublicKeyToken");
Type[] Types = SampleAssembly.GetTypes();
// Display all the types contained in the specified assembly.
foreach (Type oType in Types)
{
Console.WriteLine(oType.Name.ToString());
}
}
}

Compile is no error, but Runtime is an error.
How I will change this files?

Thank you.
 
Ad

Advertisements

J

jeremiah johnson

What is the error or Exception? What did you type to get the error?

More information please. No one will ever (well, probably not)
critisize you for supplying too much information, so give us any
information that you think is relevant.

-jeremiah

c8prog wrote:

[snip]
 
O

Octavio Hernandez

Hi,

Have you substituted:

"Assembly text name, Version, Culture, PublicKeyToken"

for the concrete details of the DLL you want to open?

Regards - Octavio
 
G

Guest

I want to compile this files without *.DLL.

I Compiled in command prompt
=> csc AssembyInfoReading.cs AssemblyInfo.cs

Run in command prompt
=> AssemblyInfoReading

Error Message
=>
Microsoft (R) Common Language Runtime Test Debugger Shell Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

(cordbg) a 0xb30
Process 2864/0xb30 created.
Warning: couldn't load symbols for
c:\windows\microsoft.net\framework\v1.1.4322\
mscorlib.dll
Warning: couldn't load symbols for
E:\Prg\DotNet\C#\Console\AssemblyInfoReading.
exe
[thread 0x5cc] Thread created.
Unable to determine existence of prolog, if any
[thread 0x248] Thread created.
[thread 0x5cc] Unhandled exception generated: (0x04bc3630)
<System.IO.FileNotFou
ndException>
_fileName=(0x04bc2ee0) "Assembly text name"
_fusionLog=(0x04bc2f18) "=== Pre-bind state information ===
LOG: DisplayName = Assembly text name
(Partial)
LOG: Appbase = E:\Prg\DotNet\C#\Console\
LOG: Initial PrivatePath = NULL
Calling assembly : AssemblyInfoReading, Version=1.1.0.1913, Culture=neutral,
Pub
licKeyToken=null.
===

LOG: Application configuration file does not exist.
LOG: Policy not being applied to reference at this time (private, custom,
partia
l, or location-based assembly bind).
LOG: Post-policy reference: Assembly text name
LOG: Attempting download of new URL
file:///E:/Prg/DotNet/C#/Console/Assembly te
xt name.DLL.
LOG: Attempting download of new URL
file:///E:/Prg/DotNet/C#/Console/Assembly te
xt name/Assembly text name.DLL.
LOG: Attempting download of new URL
file:///E:/Prg/DotNet/C#/Console/Assembly te
xt name.EXE.
LOG: Attempting download of new URL
file:///E:/Prg/DotNet/C#/Console/Assembly te
xt name/Assembly text name.EXE.
"
_className=<null>
_exceptionMethod=<null>
_exceptionMethodString=<null>
_message=(0x04bc3d2c) "not found file or assembly name Assembly text name
~ "
_innerException=<null>
_helpURL=<null>
_stackTrace=(0x04bc3dd0) array with dims=[60]
_stackTraceString=<null>
_remoteStackTraceString=<null>
_remoteStackIndex=0x00000000
_HResult=0x80070002
_source=<null>
_xptrs=0x00000000
_xcode=0xe0434f4d

Thread 0x5cc R 0x00000000: <unknown>
(cordbg)

Thank you.
 
G

Guest

I want to read 'C#' in [assembly: AssemblyTitle("C#")].
I want to read 'C# language' in [assembly: AssemblyDescription("C#
language")].

But I don't know how to read this attributes.
 
Ad

Advertisements

C

Chris R. Timmons

I'm using dotnetframework 1.1.
By the way, I don't know how to read the information of
AssemblyInfo.cs file. I wish to read it.


using System;
using System.Reflection;

[assembly: AssemblyTitle("C#")]
[assembly: AssemblyDescription("C# Language")]

namespace AttributeExample
{
public class Program
{
public static void Main()
{
Assembly SampleAssembly = Assembly.Load(Assembly.GetExecutingAssembly().FullName);

foreach (Attribute a in SampleAssembly.GetCustomAttributes(true))
{
if (a is AssemblyTitleAttribute)
Console.WriteLine("Assembly Title: " + (a as AssemblyTitleAttribute).Title);

if (a is AssemblyDescriptionAttribute)
Console.WriteLine("Assembly Description: " + (a as AssemblyDescriptionAttribute).Description);
}
}
}
}
 
Ad

Advertisements


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