473,386 Members | 1,803 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,386 software developers and data experts.

Assembly ID?

I have compiled libraries as dlls (managed) and I have to uniquely enumerate
it (kind of Guid for each one). All of them implements the same interface
(see code block) and generate ID each time it called. I want to fix it into
assembly (option 1) [maybe using SetAttribute into
AssemblyConfigurationAttribute] or use any internal GUID of assemble if
possible (Option 2). How to implement it without changing all implementation
classes (including abstracts)? Are any unique ID for compiled dll in .NET?

public Interface foo
{
Guid FooID{get;}
}
public abstract Foo:foo
{
Guid m_id=Guid.NewGuid();
public Guid ID{get{return m_id;}}
}
public class Foo1:Foo
{
}
public class Foo2:Foo
{
}

--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
Nov 16 '05 #1
5 4179
Hi Tamir:

If you strong name an assembly, then the full name of the assembly
(including the version, culture, and public key) will be unique in
space and time.

You can read the following to see more information, including links
how to create and programmatically work with assemblies:
http://msdn.microsoft.com/library/de...emblynames.asp

One caveat is: strong named assemblies do not *have* to appear in the
GAC. Sometimes these articles make it sounds as if they do (because an
assembly in the GAC has to have a strong name).

--
Scott
http://www.OdeToCode.com/

On Sun, 3 Oct 2004 10:03:31 +0200, "Tamir Khason"
<ta**********@tcon-NOSPAM.co.il> wrote:
I have compiled libraries as dlls (managed) and I have to uniquely enumerate
it (kind of Guid for each one). All of them implements the same interface
(see code block) and generate ID each time it called. I want to fix it into
assembly (option 1) [maybe using SetAttribute into
AssemblyConfigurationAttribute] or use any internal GUID of assemble if
possible (Option 2). How to implement it without changing all implementation
classes (including abstracts)? Are any unique ID for compiled dll in .NET?

public Interface foo
{
Guid FooID{get;}
}
public abstract Foo:foo
{
Guid m_id=Guid.NewGuid();
public Guid ID{get{return m_id;}}
}
public class Foo1:Foo
{
}
public class Foo2:Foo
{
}


Nov 16 '05 #2
I do not want to strong name the assembly due those files are regenerated by
code, additional obsticle is versioning.
Any other options to do this?
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:ke********************************@4ax.com...
Hi Tamir:

If you strong name an assembly, then the full name of the assembly
(including the version, culture, and public key) will be unique in
space and time.

You can read the following to see more information, including links
how to create and programmatically work with assemblies:
http://msdn.microsoft.com/library/de...emblynames.asp

One caveat is: strong named assemblies do not *have* to appear in the
GAC. Sometimes these articles make it sounds as if they do (because an
assembly in the GAC has to have a strong name).

--
Scott
http://www.OdeToCode.com/

On Sun, 3 Oct 2004 10:03:31 +0200, "Tamir Khason"
<ta**********@tcon-NOSPAM.co.il> wrote:
I have compiled libraries as dlls (managed) and I have to uniquely
enumerate
it (kind of Guid for each one). All of them implements the same interface
(see code block) and generate ID each time it called. I want to fix it
into
assembly (option 1) [maybe using SetAttribute into
AssemblyConfigurationAttribute] or use any internal GUID of assemble if
possible (Option 2). How to implement it without changing all
implementation
classes (including abstracts)? Are any unique ID for compiled dll in .NET?

public Interface foo
{
Guid FooID{get;}
}
public abstract Foo:foo
{
Guid m_id=Guid.NewGuid();
public Guid ID{get{return m_id;}}
}
public class Foo1:Foo
{
}
public class Foo2:Foo
{
}

Nov 16 '05 #3
Hi Tamir:

You could create a custom attribute to use at the assembly level, and
inspect it at runtime using reflection.

http://msdn.microsoft.com/library/de...attributes.asp
http://msdn.microsoft.com/library/de...nformation.asp

Is this more along the lines of what you are looking for?

--
Scott
http://www.OdeToCode.com/

On Sun, 3 Oct 2004 16:10:51 +0200, "Tamir Khason"
<ta**********@tcon-NOSPAM.co.il> wrote:
I do not want to strong name the assembly due those files are regenerated by
code, additional obsticle is versioning.
Any other options to do this?


Nov 16 '05 #4
Thank you for response, but in my case I do not know the value af the
attribute in compilation process, but only after the first run so I have to
write it into manifest data on runtime. The code for this is very slow and
ugly are there any other options to do this?
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:a2********************************@4ax.com...
Hi Tamir:

You could create a custom attribute to use at the assembly level, and
inspect it at runtime using reflection.

http://msdn.microsoft.com/library/de...attributes.asp
http://msdn.microsoft.com/library/de...nformation.asp

Is this more along the lines of what you are looking for?

--
Scott
http://www.OdeToCode.com/

On Sun, 3 Oct 2004 16:10:51 +0200, "Tamir Khason"
<ta**********@tcon-NOSPAM.co.il> wrote:
I do not want to strong name the assembly due those files are regenerated
by
code, additional obsticle is versioning.
Any other options to do this?

Nov 16 '05 #5
Thanks for Scott's quick response.

Hi Tamir,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to write a GUID to the
assembly when a method is called. If there is any misunderstanding, please
feel free to let me know.

As far as I know, if you're not working on a strong named assembly, the
only way is to use a custom attribute to save data at assembly level like
Scott mentioned. This persists the GUID and it can be get next time the
assembly is loaded.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #6

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

Similar topics

26
by: nospam | last post by:
Just wondering, What do you think the difference in performance would be between (1.) Compiled C# (2.) Compiled C++ (3.) and Assembly Language And how would the mix be if some if any of...
2
by: Carlos G Benevides | last post by:
I have a ASP.Net web application that has two assemblies that run under com+. Under Windows 2000 the two assemblies are added to com+ automatically when instantiated from the web site. For this...
3
by: Atul Godbole | last post by:
Suppose an assembly "Main" is using class "A" from another Assembly "Dep" as follows : A a = new A(); a.MethodOne(); At what time is the call to MethodOne linked to the actual MSIL (method...
10
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read...
7
by: R Reyes | last post by:
Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? I'm trying to manipulate MS Word from my Web Form application and I can't get passed...
3
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here...
1
by: Tim F | last post by:
Problem: I'm receiving the error "File or assembly name XXXXX or one of its dependencies, was not found." when trying to execute code in an assmebly that has both a strong-name and has been...
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",...
1
by: Coaster | last post by:
orig ref here http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/ff29cc370678911d/c0db5b7e3da283b9?lnk=st&q=gac+assembly+new+version&rnum=7#c0db5b7e3da283b9...
14
by: Monty | last post by:
Hello, I have created a solution which has both a web UI and a winform UI, the latter is just for administrators. The Web UI (a Web Application Project) and the winform project both...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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,...
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
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...

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.