I’ve been asked to list all the names and version numbers of all the services, executables and dlls that make up my project. We need to keep a record of this for each release. Is there a tool in Visual Studio that will generate a repor开发者_运维知识库t or log automatically ? If not, does anyone have a possible solution ?
As far as I know there's nothing that will do this automatically.
However, you can use reflection to do this, assuming that you use the regular .NET assembly versions:
foreach (string fileName in Directory.GetFiles(@"c:\mypath"))
{
AssemblyName assemblyName = Assembly.LoadFrom(filename).GetName();
Console.WriteLine(string.Format("{0} {1}", fileName, assemblyName.Version.ToString(4)));
}
精彩评论