--- /dev/null
+// CS1607: The version number `1.*' specified for `AssemblyFileVersion' is invalid
+// Line: 7
+// Compiler options: -warnaserror
+
+using System.Reflection;
+
+[assembly: AssemblyFileVersion ("1.*")]
if (value == null || value.Length == 0)
return;
- var vinfo = IsValidAssemblyVersion (value);
+ var vinfo = IsValidAssemblyVersion (value, true);
if (vinfo == null) {
a.Error_AttributeEmitError (string.Format ("Specified version `{0}' is not valid", value));
return;
}
} else if (a.Type == pa.RuntimeCompatibility) {
wrap_non_exception_throws_custom = true;
+ } else if (a.Type == pa.AssemblyFileVersion) {
+ string value = a.GetString ();
+ if (string.IsNullOrEmpty (value) || IsValidAssemblyVersion (value, false) == null) {
+ Report.Warning (1607, 1, a.Location, "The version number `{0}' specified for `{1}' is invalid",
+ value, a.Name);
+ return;
+ }
}
+
SetCustomAttribute (ctor, cdata);
}
Report.Error (1548, "Error during assembly signing. " + text);
}
- static Version IsValidAssemblyVersion (string version)
+ static Version IsValidAssemblyVersion (string version, bool allowGenerated)
{
string[] parts = version.Split ('.');
if (parts.Length < 1 || parts.Length > 4)
var values = new int[4];
for (int i = 0; i < parts.Length; ++i) {
if (!int.TryParse (parts[i], out values[i])) {
- if (parts[i].Length == 1 && parts[i][0] == '*') {
+ if (parts[i].Length == 1 && parts[i][0] == '*' && allowGenerated) {
if (i == 2) {
// Nothing can follow *
if (parts.Length > 3)
public readonly PredefinedAttribute AssemblyVersion;
public readonly PredefinedAttribute AssemblyAlgorithmId;
public readonly PredefinedAttribute AssemblyFlags;
+ public readonly PredefinedAttribute AssemblyFileVersion;
public readonly PredefinedAttribute ComImport;
public readonly PredefinedAttribute CoClass;
public readonly PredefinedAttribute AttributeUsage;
AssemblyVersion = new PredefinedAttribute (module, "System.Reflection", "AssemblyVersionAttribute");
AssemblyAlgorithmId = new PredefinedAttribute (module, "System.Reflection", "AssemblyAlgorithmIdAttribute");
AssemblyFlags = new PredefinedAttribute (module, "System.Reflection", "AssemblyFlagsAttribute");
+ AssemblyFileVersion = new PredefinedAttribute (module, "System.Reflection", "AssemblyFileVersionAttribute");
ComImport = new PredefinedAttribute (module, "System.Runtime.InteropServices", "ComImportAttribute");
CoClass = new PredefinedAttribute (module, "System.Runtime.InteropServices", "CoClassAttribute");
AttributeUsage = new PredefinedAttribute (module, "System", "AttributeUsageAttribute");