Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to set/read AssemblyVersion in ASP.NET 2.0

Reply
Thread Tools

How to set/read AssemblyVersion in ASP.NET 2.0

 
 
=?Utf-8?B?TWFydGluIEJpc2Nob2Zm?=
Guest
Posts: n/a
 
      10-10-2005
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
 
Reply With Quote
 
 
 
 
Scott Allen
Guest
Posts: n/a
 
      10-10-2005
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
<> 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


 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      10-10-2005
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" <> wrote in message
news:3D618E96-7723-4093-A258-...
> 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



 
Reply With Quote
 
=?Utf-8?B?TWFydGluIEJpc2Nob2Zm?=
Guest
Posts: n/a
 
      10-10-2005
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/
>


 
Reply With Quote
 
=?Utf-8?B?TWFydGluIEJpc2Nob2Zm?=
Guest
Posts: n/a
 
      10-10-2005
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" <> wrote in message
> news:3D618E96-7723-4093-A258-...
> > 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

>
>
>

 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      10-10-2005
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" <> wrote in message
news:6CD7A166-4E31-49D0-8F19-...
> 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" <> wrote in message
>> news:3D618E96-7723-4093-A258-...
>> > 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

>>
>>
>>



 
Reply With Quote
 
Scott Allen
Guest
Posts: n/a
 
      10-10-2005
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/
 
Reply With Quote
 
Bruce Barker
Guest
Posts: n/a
 
      10-10-2005
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" <> wrote in message
news:3D618E96-7723-4093-A258-...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmatically retrieving AssemblyVersion MattB ASP .Net 3 06-09-2006 10:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57