コード例 #1
0
        public void GetVersionTest()
        {
            AssemblyVersionResolver target = new AssemblyVersionResolver()
            {
                UseFileVersion = false
            };

            string result = target.GetVersion(@".\NuGet.MSBuild.Tools.dll");
        }
コード例 #2
0
        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;
        }