Determine Framework version from assembly

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

Does anyone know of a way to get the .NET Framework version that's required
by a specified assembly. I have a program I've written that creates a
Windows Installer setup for any application. However, for many of the
programs I work with there are a lot of files that have come from other
developers, and I'd like to be able to determine programmatically which
version of the Framework is required by each assembly. This way I'll know
which version to distribute with the installation.

I can load an assembly and get all of the referenced assemblies and
properties, but I just can't find a way to get the version of the Framework
it was built with.

Any help would be appreciated....

Scott
 
Scott said:
Does anyone know of a way to get the .NET Framework version that's
required by a specified assembly. I have a program I've written that
creates a Windows Installer setup for any application. However, for
many of the programs I work with there are a lot of files that have
come from other developers, and I'd like to be able to determine
programmatically which version of the Framework is required by each
assembly. This way I'll know which version to distribute with the
installation.

I can load an assembly and get all of the referenced assemblies and
properties, but I just can't find a way to get the version of the
Framework it was built with.

Any help would be appreciated....

Scott

string version =
System.Reflection.Assembly.GetExecutingAssembly().ImageRuntimeVersion;

The property is in Framework 1.1 only.

- Pete
 
Thanks, but that's what I was afraid of. I'm working with VS2002 at work so
I don't have access to the 1.1 Framework. Does anyone know of another way
this can be done even if it doesn't involve Framework calls? When I open an
assembly in a text editor I see the following string in several places
"version=1.0.3300.0" referencing mscorlib and other assemblies such as
System.Drawing. Is there any way to get this information without having to
parse the file until I come upon this string?

Thanks...

Scott
 
Back
Top