public void GetVersionTest() { AssemblyVersionResolver target = new AssemblyVersionResolver() { UseFileVersion = false }; string result = target.GetVersion(@".\NuGet.MSBuild.Tools.dll"); }
public AssemblyMetadata ExtractMetadata(string fileName, bool useFileVersion, bool useInfoVersion) { AssemblyName assemblyName = AssemblyName.GetAssemblyName(fileName); if (assemblyName != null) { AssemblyVersionResolver versionResolver = new AssemblyVersionResolver() { UseFileVersion = useFileVersion, UseInfoVersion = useInfoVersion }; string version = versionResolver.GetVersion(fileName); return new AssemblyMetadata() { Name = assemblyName.Name, Version = version, }; } return null; }