472,976 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,976 software developers and data experts.

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 6100
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
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
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
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
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
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
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
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
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
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...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.