.NETGURU
How to associate a GACed assembly with run-time version?
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.clr.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Sergey M
Hi all,

I have an application that collects GACed assemblies published by
Microsoft only and their types using Fusion APIs. The application's
written using VS.NET 2003. I'd like for the application to only target
run-time v1.1 GACed assemblies.

I've managed to isolate Microsoft's assemblies by validating
PublicKeyToken. The problem I'm having is trying to figure out how to
associate an assembly in GAC with run-time v1.1. I'd like to avoid
dynamically loading run-time v1.0 assemblies.

Trying to match application run-time version (Environment.Version) to
assembly version works most of the times but there are some exceptions.
Some of the VS.NET 2003 assemblies have a different version scheme that
starts with major version 7.0. Some have different builder numbers for
VS.NET 2002 and 2003. There are also few of them that only have one
version in GAC and it matches VS.NET 2002 version number, yet is
installed into v1.1 folder, EnvDTE v7.0.3300.0 for example.

Could anyone shed some light onto this or give me a push into a right
direction please? Thanks in advance.
--
Sergey M
http://www.usysware.com/dpack/

Reply to this message...
 
    
Dot Net Guruias Sjögren
Sergey,

The set of assemblies included with v1.1 of the framework is limited.
Why don't you just keep a static list of assemblies known to be
included?

Dot Net Guruias

--
Dot Net Guruias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Reply to this message...
 
    
Sergey M
Dot Net Guruias,

[Original message clipped]

Hmm... I may miss some assemblies that need to be included. I also plan
on supporting framework v2.0 when it's released and I'd hate to have to
"figure out", i.e. hard-code new assembly names.

Actually I don't have a problem getting framework assemblies with the
version # matching to the runtime's version. That part works fine. But
there are some assemblies that seem(?) to be compiled against 1.0
framework yet, they also get referenced by 1.1 assemblies. For instance,
EnvDTE used by VS.NET itself is being *just* one of several.
--
Sergey M
http://www.usysware.com/dpack/

Reply to this message...
 
    
Junfeng Zhang[MSFT] (VIP)
Since you are using .Net framework 1.1, the following should work for you:

1. mscoree!GetFileVersion will tell you which runtime the assembly is
compiled against. I briefly talked about this API here
http://blogs.msdn.com/junfeng/archive/2004/02/06/68334.aspx" target="_blank">http://blogs.msdn.com/junfeng/archive/2004/02/06/68334.aspx.

2. Assume you know how to use 1). And you can identity Microsoft Assemblies
by validating publicKeyToken. What you can do is enumerate GAC, find the
path of every assembly, call mscoree!GetFileVersion on the file. If
mscoree!GetFileVersion reports v1.1.4322, then it belongs to 1.1. If it
returns v1.0.3705, then it belongs to 1.0.

Of course, in 2) you will have to use Fusion APIs.

Anything starts with a version number 7.x belongs to Visual Studio. For 1.0
and 1.1 framework assemblies, their version numbers always start with 1.0.
Some of VS assemblies are shared between VS 2002 and VS 2003.

--
Junfeng Zhang
http://blogs.msdn.com/junfeng

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

"Sergey M" <no_spam_for_you> wrote in message
news:%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Sergey M
Junfeng,

> Since you are using .Net framework 1.1, the following should work for
you:

Thanks for all of your suggestions. I've been busy sorting out all of
the fusion APIs issues in my code and about to revisit versioning again.
I'll go over your suggestions and report back in few days. Thanks again.
--
Sergey M
http://www.usysware.com/dpack/

Reply to this message...
 
    
Sergey M
Junfeng,

[Original message clipped]

I do most of what you've described already. What I seem to be having
problems with is trying to figure out on how to not filter out VS.NET
2002/2003 shared assemblies. According to you, shared assemblies would
show up as belonging to framework v1.0. Yet, they also get referenced
and loaded by VS.NET 2003, which obviously uses v1.1.

Do you have any suggestions as to how to detect those kinds of
assemblies as shared, short of creating a custom list of assembly
names to check against? I keep on bring it up but just one example of
such assembly is EnvDTE one.

Any further help or suggestions would be very much appreciated.
Thanks.
--
Sergey Mishkovskiy
http://www.usysware.com/dpack/

Reply to this message...
 
    
Junfeng Zhang[MSFT] (VIP)
I did not realize VS 2002/2003 actually shares assemblies.

I guess the easiest thing to do is to get the list of the assemblies
installed in v1.0, v1.1, VS 2002, VS 2003.

--
Junfeng Zhang
http://blogs.msdn.com/junfeng
This posting is provided "AS IS" with no warranties, and confers no rights.

"Sergey M" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Sergey M
Any ideas?
--
Sergey M
http://www.usysware.com/dpack/

"Sergey M" <no_spam_for_you> wrote in message
news:%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.Environment




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification