Version of the code behind Assembly

G

Guest

In ASP.NET 1.1 I used to retreive the version of my code-behind assembly
using following syntax:
Assembly.GetExecutingAssembly().GetName().Version
The version was defined in AssemblyInfo.cs using
[assembly: AssemblyVersion("1.10.*")]

After migrating to ASP.NET 2.0 this line of code always return 0.0.0.0. How
do I retreive the assembly version of ASP.NET application?

Thanks
 
S

Steven Cheng[MSFT]

Hi Andrewb,

Welcome to ASPNET newsgroup.
Regarding on the querying asp.net 2.0 web application's assembly version
problem it is actually due to the new compilation model of ASP.NET 2.0 web
application and vs 2005 website project. In ASP.NET 2.0 and vs 2005, we no
longer have a precompiled assembly (dll) in the "bin" dir for the
application's code behind classes or any other component classes... ,
instead it make those classes be dynamically compiled at runtime or fully
precompiled at deployment time(if we use the publish web site in vs 2005 or
use aspnet_compiler.exe command line tool).... So when we use
Assembly.GetExecutingAssembly().GetName().Version

it is actually querying the dynamic compiled assembly's version which will
be 0.0.0.0 ..... You can also find some other threads and article in
newsgroup or web forum indicating this.

Currently, since we did receive many customers and community members's
feedback on the old project assembly and compilation model, the ASP.NET
team is about to provide two new project type , one is for web
application's deployment, which can help do some customization on the final
precompiled assembly, such as apply version number or strong-name ...

And another project is used for provide the ASP.NET 1.1/VS2003 like project
type which will let us compiled a single main assembly for each web
application. Here are the links to their beta preview site on msdn center:

#Visual Studio 2005 Web Application Projects (Beta Preview)
http://msdn.microsoft.com/asp.net/reference/infrastructure/wap/default.aspx


#Visual Studio 2005 Web Deployment Projects (Beta Preview)
http://msdn.microsoft.com/asp.net/reference/infrastructure/wdp/default.aspx

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)





--------------------
| Thread-Topic: Version of the code behind Assembly
| thread-index: AcYga9vfI831AFxyTGGe4U+2CCvIvQ==
| X-WBNR-Posting-Host: 68.148.0.205
| From: =?Utf-8?B?QW5kcmV3?= <[email protected]>
| Subject: Version of the code behind Assembly
| Date: Mon, 23 Jan 2006 14:25:04 -0800
| Lines: 10
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:372990
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| In ASP.NET 1.1 I used to retreive the version of my code-behind assembly
| using following syntax:
| Assembly.GetExecutingAssembly().GetName().Version
| The version was defined in AssemblyInfo.cs using
| [assembly: AssemblyVersion("1.10.*")]
|
| After migrating to ASP.NET 2.0 this line of code always return 0.0.0.0.
How
| do I retreive the assembly version of ASP.NET application?
|
| Thanks
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top