473,511 Members | 13,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to set/read AssemblyVersion in ASP.NET 2.0

How can I set the assembly version in an ASP.NET 2.0 project?

I have added a file AssemblyInfo.cs containing the version number to my
project's App_Code folder. When I try to read the version number from my code
I always get "0.0.0.0".
In ASP.NET 1.1 I was able to read the version of my web application using
the same code.

Thanks for any help,
Martin
Nov 19 '05 #1
7 6122
Where is the code located that reads the assembly version? Is it in
the code file for an ASPX web form? If you post the code I'll give it
a try.

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

On Mon, 10 Oct 2005 05:56:06 -0700, Martin Bischoff
<ni******@newsgroup.nospam> wrote:
How can I set the assembly version in an ASP.NET 2.0 project?

I have added a file AssemblyInfo.cs containing the version number to my
project's App_Code folder. When I try to read the version number from my code
I always get "0.0.0.0".
In ASP.NET 1.1 I was able to read the version of my web application using
the same code.

Thanks for any help,
Martin


Nov 19 '05 #2
When you open the assembly with Reflector
( http://www.aisto.com/roeder/dotnet/ )
doesn't it show the assembly's version number ?

It does for my assemblies, and I don't do anything special to set them.

In any case, read : http://www.devx.com/codemag/Article/28747/0/page/3
if you want to set a specific assembly version number.

Take a look at the dialogue in Figure 3.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Martin Bischoff" <ni******@newsgroup.nospam> wrote in message
news:3D**********************************@microsof t.com...
How can I set the assembly version in an ASP.NET 2.0 project?

I have added a file AssemblyInfo.cs containing the version number to my
project's App_Code folder. When I try to read the version number from my code
I always get "0.0.0.0".
In ASP.NET 1.1 I was able to read the version of my web application using
the same code.

Thanks for any help,
Martin

Nov 19 '05 #3
Yes, the code is located in a code file, e.g:
protected string VersionInfo
{
get
{
return
System.Reflection.Assembly.GetAssembly(this.GetTyp e()).GetName().Version.ToString();
}
}

The version number is stored in a file AssemblyInfo.cs (which I put into
App_Code):
[assembly: AssemblyVersion("5.0.*")]

It seems this does no longer work, since the web app is not compiled into
one assembly. But I guess there is some way to set and read the version of a
web application.

Thanks for any tips,
Martin Bischoff

"Scott Allen" wrote:
Where is the code located that reads the assembly version? Is it in
the code file for an ASPX web form? If you post the code I'll give it
a try.

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


Nov 19 '05 #4
Thanks for your answer, but it does not help. I'm trying to set and read the
version of a web application (not a class library).

Regards,
Martin Bischoff

"Juan T. Llibre" wrote:
When you open the assembly with Reflector
( http://www.aisto.com/roeder/dotnet/ )
doesn't it show the assembly's version number ?

It does for my assemblies, and I don't do anything special to set them.

In any case, read : http://www.devx.com/codemag/Article/28747/0/page/3
if you want to set a specific assembly version number.

Take a look at the dialogue in Figure 3.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Martin Bischoff" <ni******@newsgroup.nospam> wrote in message
news:3D**********************************@microsof t.com...
How can I set the assembly version in an ASP.NET 2.0 project?

I have added a file AssemblyInfo.cs containing the version number to my
project's App_Code folder. When I try to read the version number from my code
I always get "0.0.0.0".
In ASP.NET 1.1 I was able to read the version of my web application using
the same code.

Thanks for any help,
Martin


Nov 19 '05 #5
Indeed, I thought you were trying to read an
assembly's ( class library ) version number.

FWIW, using Reflector on assemblies generated by ASP.NET 2.0
(in the "ASP.NET Temporary Files" directory) yields 0.0.0.0 for
all the applications I have running, including pre-compiled apps.


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Martin Bischoff" <ni******@newsgroup.nospam> wrote in message
news:6C**********************************@microsof t.com...
Thanks for your answer, but it does not help. I'm trying to set and read the
version of a web application (not a class library).

Regards,
Martin Bischoff

"Juan T. Llibre" wrote:
When you open the assembly with Reflector
( http://www.aisto.com/roeder/dotnet/ )
doesn't it show the assembly's version number ?

It does for my assemblies, and I don't do anything special to set them.

In any case, read : http://www.devx.com/codemag/Article/28747/0/page/3
if you want to set a specific assembly version number.

Take a look at the dialogue in Figure 3.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Martin Bischoff" <ni******@newsgroup.nospam> wrote in message
news:3D**********************************@microsof t.com...
> How can I set the assembly version in an ASP.NET 2.0 project?
>
> I have added a file AssemblyInfo.cs containing the version number to my
> project's App_Code folder. When I try to read the version number from my code
> I always get "0.0.0.0".
> In ASP.NET 1.1 I was able to read the version of my web application using
> the same code.
>
> Thanks for any help,
> Martin


Nov 19 '05 #6
Hey Martin:

I tried:

Assembly.GetExecutingAssembly().GetName().Version. ToString();

If I use the above in an .aspx code file, I get 0.0.0.0.

If I use the above in a class that I have in a .cs file inside
App_Code, I can get the assembly version that I placed in a .cs file
in App_Code also.

I think this makes sense, given...

It seems this does no longer work, since the web app is not compiled into
one assembly.

.... yeah, that's the tricky part. Around RTM time the ASP.NET should
be releasing a build and deployment project that will have, among
other features, the ability to package all of the assebmlies for a web
app into a single assembly. That should make this easier.

--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #7
in asp.net 2.0 each page is built into it own assembly, so only the dll the
AssemblyInfo.cs is built into will return the correct answer. just add a
static method to AssemblyInfo.cs that returns the version info, and call
this method from your other pages.

-- bruce (sqlwork.com)

"Martin Bischoff" <ni******@newsgroup.nospam> wrote in message
news:3D**********************************@microsof t.com...
How can I set the assembly version in an ASP.NET 2.0 project?

I have added a file AssemblyInfo.cs containing the version number to my
project's App_Code folder. When I try to read the version number from my
code
I always get "0.0.0.0".
In ASP.NET 1.1 I was able to read the version of my web application using
the same code.

Thanks for any help,
Martin

Nov 19 '05 #8

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

Similar topics

0
274
by: Mark | last post by:
In the AssemblyInfo.cs page of a ASP.NET project, there is a defaulted property of: It's my understanding that this indicates a Major Version of 1, a Minor Version of 0, and a Build and...
2
6720
by: Mark | last post by:
In the AssemblyInfo.cs page of a ASP.NET project, there is a defaulted property of: It's my understanding that this indicates a Major Version of 1, a Minor Version of 0, and a Build and...
4
8072
by: Matthew Smith | last post by:
Is there a way to get the value that is stored in the AssemblyVersion attribute that's in AssemblyInfo.cs?
5
36402
by: c8prog | last post by:
I'm using dotnetframework 1.1. By the way, I don't know how to read the information of AssemblyInfo.cs file. I wish to read it. The following Example Files. File 1: AssemblyInfo.cs using...
1
5090
by: | last post by:
In C#, when one specifies an assembly attribute for the Assembly version, this becomes the file version as well. In Managed C++, there appears to be no relation between the assembly attribute and...
7
16334
by: Michael Maes | last post by:
Hi, Setting the Assembly Version is no problem (<Assembly: AssemblyVersion("1.1.20043.13")>) but how do I set the FileVersion (of the dll)? TIA, Michael
3
1743
by: AnthonyWJones | last post by:
I see from my searches that this has be discussed before. However I can find no satisfactory answer or any reference to this problem being a bug. From the MSDN documentation for this...
3
38205
by: herc | last post by:
How does one get the AssemblyVersion of the currently excuting assembly? At first glance, it would appear that this would give you the AsseblyName which will give you the version: string...
3
1419
by: MattB | last post by:
I searched around a little and I don;t see how I can get the AssemblyVersion of the main assembly of my asp.net 1.1 application. Can anyone point me to an example? I want to be able to display this...
0
7245
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
7144
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7356
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
7427
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...
0
5671
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3227
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...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.