Found part of the answer...
To partially answer my own question, I have since discovered this:
Visual Build Pro approach:
In the .NET build step on the "Versions" tab, select the radio button "Set the project version to a specific value before building", and in the edit box put something like 1.0.0.%BUILDNUM% . Also, select these two check boxes: "Update the File version" and "Update the Assembly version". Thus, the .NET assembly's "Assembly version" and "File version" will now be the same, and set to a value that you have determined at build time, controlled by a Visual Build Pro macro.
.NET compiler approach:
I have started to write a utility program that (a) loads a user-specified assembly, (b) examines the assembly version and file version info., and (c) sets the file version to be the value of the assembly version. Here is the Visual C# code for parts (a) and (b) -- can anyone help me with the code for part (c)?
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Diagnostics; // for FileVersionInfo
.
.
.
// Get the assembly information and display to the console.
string thefile = "C:/MyAssembly.dll";
// Get the file's "Assembly Version" information
AssemblyName myAssemblyName = AssemblyName.GetAssemblyName(thefile);
string assemblyver = myAssemblyName.Version.ToString();
Console.WriteLine("\nThe assembly version is:");
Console.WriteLine(assemblyver);
// Note: if you want to see "all the info." instead of just the assembly version:
// Console.WriteLine("\nDisplaying the assembly information of 'core.dll'\n");
// Console.WriteLine(myAssemblyName.ToString());
// Get the file's "File Version" information
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(thefile);
string results = "\nThe file version is:\n" + myFileVersionInfo.FileVersion;
Console.WriteLine(results);
// Set the "File Version" to the same value as the "Assembly Version"
// ??? how to do this?
|