-
Notifications
You must be signed in to change notification settings - Fork 657
Closed
Description
http://gitversion.readthedocs.org/en/latest/usage/#msbuild-task says
Ensure you remove the Assembly*Version attributes from your Properties\AssemblyInfo.cs file so as to not get duplicate attribute warnings. Sample default:
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+Branch.master.Sha.722aad3217bd49a6576b6f82f60884e612f9ba58")]
In fact you need to have these attributes in the AssemblyInfo.cs file otherwise they will not be set. Data is just replaced by Regex and not created if it does not exist.
AssemblyInfoFileUpdate.cs --> public AssemblyInfoFileUpdate
var fileContents = fileSystem.ReadAllText(assemblyInfoFile)
.RegexReplace(@"AssemblyVersion\(""[^""]*""\)", string.Format("AssemblyVersion(\"{0}\")", assemblyVersion))
.RegexReplace(@"AssemblyInformationalVersion\(""[^""]*""\)", string.Format("AssemblyInformationalVersion(\"{0}\")", assemblyInfoVersion))
.RegexReplace(@"AssemblyFileVersion\(""[^""]*""\)", string.Format("AssemblyFileVersion(\"{0}\")", assemblyFileVersion));
Metadata
Metadata
Assignees
Labels
No labels