Peter Himschoot

Peter Himschoot's blog

<January 2009>
SuMoTuWeThFrSa
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567


Navigation

Subscriptions

Post Categories



DOTNET (RSS)

.NET development in general
Moving my blog over to U2U

Hi,

from now on I will be blogging from http://blog.u2u.info/DottextWeb/peter/ 

I would like to thank dotnetjunkies for enabling me to blog through their site but since we started our own blog at U2U (see www.u2u.info for more blogs) I am moving there.

Peter

posted Monday, September 13, 2004 7:09 AM by peterh with 4 Comments

Keeping versions of .NET assemblies in sync

Hi,

a couple of days ago someone asked me how to keep several assemblies part of the same solution in sync. Some time ago I used the following technique:

Create a new assembly, for example called Build, with a class called VersionInf

namespace BestPractices.Build

{

  public class VersionInfo

  {

    public const string Version = "1.0.0.0";

    public const string Company = "SomeCompany";

    public const string Product = "MyQualityProduct";

    public const bool DelaySign = false;

    public const string KeyFile = @"c:\SN.snk";

  }

}

After building this assembly you can use it in other assemblies' AssemblyInfo like this (removed all comments to save space):

using System.Reflection;

using System.Runtime.CompilerServices;

using BestPractices.Build;

[assembly: AssemblyTitle("")]

[assembly: AssemblyDescription("")]

[assembly: AssemblyConfiguration("")]

[assembly: AssemblyCompany(VersionInfo.Company)]

[assembly: AssemblyProduct(VersionInfo.Product)]

[assembly: AssemblyCopyright("")]

[assembly: AssemblyTrademark("")]

[assembly: AssemblyCulture("")]                            

[assembly: AssemblyVersion(VersionInfo.Version)]

[assembly: AssemblyDelaySign(VersionInfo.DelaySign)]

[assembly: AssemblyKeyFile(VersionInfo.KeyFile)]

[assembly: AssemblyKeyName("")]

Because constants are copied to the dependent assembly you actually only need the build assembly at-compile time.

Now each assembly will have the same version, keyfile, etc... If you want to update the version (like in a daily-build scenario) you only have to update the VersionInfo.cs file.

 

posted Wednesday, July 21, 2004 7:49 AM by peterh with 5 Comments




Powered by Dot Net Junkies, by Telligent Systems