473,396 Members | 2,020 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,396 software developers and data experts.

Assembly attribute ???

Dear all,

In my assembly info file I have such kind of default
information :

<Assembly: AssemblyTitle("")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>

Can I add any other type of information I want like as
follow :
<Assembly: AssemblyKeyCode("3215462452158")>

If yes how can I access that key from code?

thanks for your information
regards
serge

Jul 21 '05 #1
2 1638

"serge calderara" <se*************@maillefer.net> wrote in message
news:03****************************@phx.gbl...
Dear all,

In my assembly info file I have such kind of default
information :

<Assembly: AssemblyTitle("")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
Naturally.

Can I add any other type of information I want like as
follow :
<Assembly: AssemblyKeyCode("3215462452158")>
Yes. Look in the documentation on how to create your own Attribute. It is
basically a class inheriting from Attribute with an attribute on itself
telling the compiler here you are allowed to put it.
If yes how can I access that key from code?


Using reflection. Get ahold of the Assembly "object" (yes, it is an object,
too) for the assembly, and call the GetCustomAttributes method on it.

Assembly a; // which you can get from a type when you have it

AssemblyKeyCodeAttribute [] kcaa =
a.GetCustomAttribuges(typeof(AssemblyKeyCodeAttrib ute));

The rest is in the documentation.

Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
Jul 21 '05 #2
Thanks for your reply...

Is there a way to change assembly attribute during runtime?

In fact what I am thinking of is a way of having a kind of
licence activation for our asembly when distributed.
I was thinking to handle it in the following way:

1- I scann first for the existance of the assembly in the
system

2- then I check th MAC adress of the install system
3- then I combine that mac adress with assembly product
code and may be write thea crypted code somewhere

4- during runtime if that code is valid, I will check one
assembly atrtribute which could be AsssemblyLicCounter

if this lic Counter = 2 then it means that it is able to
use 2 licence, when one is used i decrease that counter by
1, if it reach 0 then he cannot use any extra licence
until we provide hime an extension.

Does it sounds something simple or too crazy or too
complex?

In addition I woul like to get that licence installed in
only one system, in order to avoid copy

thanks for your comments
regards
serge
-----Original Message-----

"serge calderara" <se*************@maillefer.net> wrote in messagenews:03****************************@phx.gbl...
Dear all,

In my assembly info file I have such kind of default
information :

<Assembly: AssemblyTitle("")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
Naturally.

Can I add any other type of information I want like as
follow :
<Assembly: AssemblyKeyCode("3215462452158")>


Yes. Look in the documentation on how to create your own

Attribute. It isbasically a class inheriting from Attribute with an attribute on itselftelling the compiler here you are allowed to put it.
If yes how can I access that key from code?
Using reflection. Get ahold of the Assembly "object"

(yes, it is an object,too) for the assembly, and call the GetCustomAttributes method on it.
Assembly a; // which you can get from a type when you have it
AssemblyKeyCodeAttribute [] kcaa =
a.GetCustomAttribuges(typeof(AssemblyKeyCodeAttri bute));

The rest is in the documentation.

Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
.

Jul 21 '05 #3

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

Similar topics

0
by: Erick Shuai | last post by:
In my project, I need to use custom attribute on all assemblies. This attribute will implement some non-functional code and I want to use it on assembly scope(AttributeTargets is Assembly). I...
1
by: Russ Green | last post by:
I'm trying to retrieve the version attribute of the current assembly in Console and Service applications. I've tried the following method but it doesn't work for me. Any ideas: ' Return the...
2
by: serge calderara | last post by:
Dear all, In my assembly info file I have such kind of default information : <Assembly: AssemblyTitle("")> <Assembly: AssemblyDescription("")> <Assembly: AssemblyCompany("")> Can I add...
1
by: Andreas Mueller | last post by:
Hi all, I have an attribute class: class MyAttribute : Attribute { public MyAttribute(){ } }
3
by: Dan Holmes | last post by:
If i have Class2 that is inherited by Class1, how can Class1's methods operate on Class2's assembly information? For instance: public class Component { public virtual List<ComponentInfo>...
4
by: Brian Richards | last post by:
Is it possible to run code in an assembly when it's loaded? In my case I have an assembly that requires that the users path be setup correctly or GetTypes() will throw an exception. Looking for a...
2
by: Paul | last post by:
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",...
4
by: Ron M. Newman | last post by:
Hi: How do I get the GUID string out of an assembly? (I have it loaded and referenced from an Assembly obect). -Ron
7
by: Paul Hadfield | last post by:
Hi, I'm running into one problem with trying to call "Type.GetCustomAttributes(...)" on my reflected code. Basically - I can't trap my own custom attribute - I can only catch / identify system...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.