Assembly Version

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In the 1.1 framework the assemly Version would optionally auto-increment.
In the 2.0 framework the auto increment seems to be only available on
one-touch deployment.
How can I put auto-increment back on a non-one-touch assembly?
(I am written a windows service)
 
Arne,

Thanks for your post or I would not have noticed this odd behavior (until much
later on)...

Using google, I find that there are a couple of "solutions" available for this
but it seems that the following is at least sponsered (but not "blessed" by MS):

<http://blogs.msdn.com/msbuild/archive/2005/11/11/491947.aspx>

So this is how I've gone until proven otherwise. I have just done a vanilla
install after downloading from here:

<http://www.gotdotnet.com/codegallery/codegallery.aspx?id=93d23e13-c653-4815-9e79-16107919f93e>

Here is what I had to do:

(a) Download the file(s). There are 3 links in the lower right of the above
page. I got all 3 but the only one you really need is one in the middle unless
you want the source and a duplicate copy of the help file.

(b) Unzip the file and run the setup. When prompted, install into the Global
area. This will create a new dir at C:\Program
Files\MSBuild\Microsoft\AssemblyInfoTask and place two files in it:
AssemblyInfoTask.chm and Microsoft.VersionNumber.targets. The first is the help
file, the second is the addin's config file.

(c) Open and read the help file. I looked only at the Getting Started page. The
rest details how the numbering is formatted and computed and speaks to how to
override the default behavior.

(d) You have to edit every project's definition file (in C#, *.csproj) and add
an entry to cause the auto-incrementer to get used on that project. There may
be more than one per solution but you have to do it at the project level rather
than the solution level. Yuuck! The Getting Started page in the help file tells
how to do this from within VS2005 but you can do it with a text editor as well
(if you exit VS2005 first). Basically, you find the last line in each .csproj
file that begins with "<Import" and add the following line after it:

<Import
Project="$(MSBuildExtensionsPath)\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets"/>

(e) When restarting VS2005 (or when reloading the project if (d) is done within
VS2005, you will get a warning about the project file having been diddled. You
can just respond to load normally. If you'd prefer to not get prompted all the
time (and who wouldn't) you need to add a new value in the registry under the key:

HKLM_Software\Microsoft\VisualStudio\8.0\MsBuild\SafeImports

If you look there you will see there are existing string values. Mine were
named VisualStudio1-9. I don't think the name matters but I followed the naming
pattern and created VisualStudio10. You then set the string's value to the
following:

C:\Program
Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.targets

You no longer get prompted.

This all seems an incredible pain given that we only want to reproduce the
behavior that was previously automatic in VS2003. Let me know if you become
aware of an alternate, simpler approach.

David
 
Back
Top