views:

313

answers:

1

Hi guys,

I have an ASP.NET project that contains a Web Deployment project (to compile the website) and a Setup project (that creates the Setup and install the compiled version of the website).

I always change the application version on the Setup Project and I want to be able to reference that version number into the Website itself but without creating an entry in the web.config with the version number (not today, but I think that in the future I will forgot to change the version number in the web.config)

Is there any trick that I can use to get this behaviour?

Just like using the App.Config in WinForms using just:

Version vrs = new Version(Application.ProductVersion);
myVersionLabel.Text = "Major: " + vrs.Major + " Minor: " + vrs.Minor;
+2  A: 

You can always do a custom action that writes/updated the setup version to your web.config. No worries about forgetting to do that manually. EDIT: I made a blog post about how to do this. Take a look here.

Magnus Johansson
any idea on how do I accomplish that?
balexandre
I just made a blog post about how to do that, see my edit notes in my answer above. Hope it helps.
Magnus Johansson
just to add: with the free version of Jing (www.jingproject.com) you could create a nice tutorial for this, I know it will help a lot of guys like me ;)
balexandre