473,699 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Assembly attribute ???

Dear all,

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

<Assembly: AssemblyTitle(" ")>
<Assembly: AssemblyDescrip tion("")>
<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 1659

"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: AssemblyDescrip tion("")>
<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 GetCustomAttrib utes method on it.

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

AssemblyKeyCode Attribute [] kcaa =
a.GetCustomAttr ibuges(typeof(A ssemblyKeyCodeA ttribute));

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 AsssemblyLicCou nter

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: AssemblyDescrip tion("")>
<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 GetCustomAttrib utes method on it.
Assembly a; // which you can get from a type when you have it
AssemblyKeyCod eAttribute [] kcaa =
a.GetCustomAtt ribuges(typeof( AssemblyKeyCode Attribute));

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
1610
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 add code "" in file AssemblyInfo.cs. But it seemed that it didn't work. I don't know why. CODE AS BELOW:
1
1320
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 assembly's Version attribute value. Public Function GetAssemblyVersion() As String Dim m_MyAssembly As = .GetExecutingAssembly If m_MyAssembly.IsDefined(GetType(AssemblyVersionAttribute), True) Then Dim attr As Attribute = _
2
310
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 any other type of information I want like as
1
1501
by: Andreas Mueller | last post by:
Hi all, I have an attribute class: class MyAttribute : Attribute { public MyAttribute(){ } }
3
2679
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> GetAssemblyInfo() { try {
4
8243
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 work around to just requiring the user to have the Path environment setup in the calling application. class MyAssemblyLoader { public Type GetTypes(String assemblyName) {
2
11764
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", 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.
4
5211
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
2362
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 "Custom Attributes" by type. The output below identifies that I can catch the "DefaultMemberAttribute", but I can not catch my own "DirectoryVersionAttribute". Cany anyone throw any light on this as it is driving mad Thanks in Advance, - Paul....
0
8687
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
8617
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,...
1
8914
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
8884
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7751
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5875
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
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
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
2
2347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.