473,748 Members | 2,398 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 1668

"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
1615
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
1324
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
1504
by: Andreas Mueller | last post by:
Hi all, I have an attribute class: class MyAttribute : Attribute { public MyAttribute(){ } }
3
2682
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
8247
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
11767
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
5214
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
2366
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
8991
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
9544
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9324
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
9247
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...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3313
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
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.