-
Notifications
You must be signed in to change notification settings - Fork 0
/
assembly-version.htm
148 lines (139 loc) · 11.4 KB
/
assembly-version.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8" />
<title>Assembly version</title>
</head>
<body><a href="https://github.com/ArsenShnurkov/gentoo-mono-handbook"><img alt="Fork me on GitHub" id="forkme" src="images/forkme.png" align="right" width="100" /></a>
<table><tr><td style="vertical-align:top;">
<h1>Assembly version</h1>
</td><td style="vertical-align:top;">
<a href="index.htm">Gentoo Mono Handbook</a>
<br />
<a href="../Using_versionator_to_cut_version.htm">Using versionator to cut version</a>
<br />
<table><tr><td>$PV</td><td>Package version (excluding revision, if any), for example 6.3. It should reflect the upstream versioning scheme.</td></tr></table>
</td></tr></table>
<h2>loresoft/msbuildtasks</h2>
<a href="https://github.com/loresoft/msbuildtasks/blob/master/Documentation/TaskDocs.md#AssemblyInfo">https://github.com/loresoft/msbuildtasks/blob/master/Documentation/TaskDocs.md#AssemblyInfo</a>
<h3>For own project</h3>
1. Modify .csproj file, insert the following code:
<pre>
<Import Project="$(MSBuildExtensionsPath)\MSBuild.Community.Tasks.Targets" />
<Target Name="BeforeBuild">
<PropertyGroup Condition=" '$(VersionNumber)' == '' ">
<VersionNumber>1.0.0.0</VersionNumber>
</PropertyGroup>
<AssemblyInfo CodeLanguage="C#"
OutputFile="Properties/AssemblyVersion.cs"
AssemblyVersion="$(VersionNumber)"
AssemblyFileVersion="$(VersionNumber)"
/>
</Target>
<br />
2. Modify AssemblyInfo.cs to remove version attributes duplication
</pre>
3. Add .AssemblyVersion.cs into .gitignore
<br />
4. Make a commit to sources repository, make new digest for new archive
<br />
5. Add
<br />
DEPEND=">=dev-dotnet/msbuildtasks-1.5.0.240"
<br />
6. Insert these lines into ebuild:
<br />
ASSEMBLY_VERSION="${PV}"
<br />
exbuild /p:VersionNumber="${ASSEMBLY_VERSION}"
<br />
<br />
example of change:
<br />
<a href="https://github.com/ArsenShnurkov/ApacheModmono.Web.Administration/commit/d720185fbb5fe1ef959d608c468ec3027c58164d">in sources</a>
<br />
<a href="https://github.com/ArsenShnurkov/shnurise/commit/d2795c59d589ef7af3ad529f1dffc5905474d943">in ebuild</a>
<h3>For external project</h3>
1. Make patch for .csproj file
<br />
2. Insert eapply into ebuild
<br />
then preform steps 5. and 6 from above
<h2>How to do the same without msbuildtasks</h2>
<a href="http://stackoverflow.com/questions/8446693/specify-assembly-version-number-as-a-command-line-argument-in-msbuild">http://stackoverflow.com/questions/8446693/specify-assembly-version-number-as-a-command-line-argument-in-msbuild</a>
<br />
<a href="http://stackoverflow.com/questions/10980249/msbuild-task-for-setting-custom-attribute-in-assemblyinfo-cs">http://stackoverflow.com/questions/10980249/msbuild-task-for-setting-custom-attribute-in-assemblyinfo-cs</a>
<pre>
<Target Name="BeforeBuild">
<PropertyGroup Condition=" '$(VersionNumber)' == '' ">
<VersionNumber>1.0.0.0</VersionNumber>
</PropertyGroup>
<ItemGroup>
<AssemblyAttributes Include="AssemblyVersion">
<_Parameter1>$(VersionNumber)</_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyFileVersion">
<_Parameter1>$(VersionNumber)</_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyInformationalVersion">
<_Parameter1>$(VersionNumber)</_Parameter1>
</AssemblyAttributes>
</ItemGroup>
<WriteCodeFragment Language="C#" OutputFile="Properties/AssemblyVersion.cs" AssemblyAttributes="@(AssemblyAttributes)" />
</Target>
</pre>
<h2>mikefourie/MSBuildExtensionPack</h2>
<a href="https://github.com/mikefourie/MSBuildExtensionPack">https://github.com/mikefourie/MSBuildExtensionPack</a>
<br />
<br />
<a href="http://stackoverflow.com/questions/3585444/how-can-i-change-assemblyproduct-assemblytitle-using-msbuild">http://stackoverflow.com/questions/3585444/how-can-i-change-assemblyproduct-assemblytitle-using-msbuild</a>
<h2>Maximum of version part is 65534</h2>
Properties/AssemblyInfo.cs(11,30): error CS7034: The specified version string `4.3.11.65536' does not conform to the required format - major[.minor[.build[.revision]]]
<br />
<a href="https://blogs.msdn.microsoft.com/msbuild/2007/01/03/why-are-build-numbers-limited-to-65535/">https://blogs.msdn.microsoft.com/msbuild/2007/01/03/why-are-build-numbers-limited-to-65535/</a>
<br />
<a href="http://stackoverflow.com/questions/37941195/the-specified-version-string-does-not-conform-to-the-required-format-major-mi">http://stackoverflow.com/questions/37941195/the-specified-version-string-does-not-conform-to-the-required-format-major-mi</a>
<br />
for 65535 it gives another error:
<pre>
Mono.CSharp.InternalErrorException: Failed to import assembly `System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.ArgumentException: Value does not fall within the expected range.
at IKVM.Reflection.Fusion.CompareAssemblyIdentityPure (System.String assemblyIdentity1, System.Boolean unified1, System.String assemblyIdentity2, System.Boolean unified2, IKVM.Reflection.AssemblyComparisonResult& result) [0x000e3] in <65ad872b0e564119b94b07e7497063eb>:0
at IKVM.Reflection.Universe.CompareAssemblyIdentity (System.String assemblyIdentity1, System.Boolean unified1, System.String assemblyIdentity2, System.Boolean unified2, IKVM.Reflection.AssemblyComparisonResult& result) [0x0001c] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.StaticLoader.AssemblyReferenceResolver (System.Object sender, IKVM.Reflection.ResolveEventArgs args) [0x0004b] in <65ad872b0e564119b94b07e7497063eb>:0
at IKVM.Reflection.Universe.Load (System.String refname, IKVM.Reflection.Module requestingModule, System.Boolean throwOnError) [0x00060] in <65ad872b0e564119b94b07e7497063eb>:0
at IKVM.Reflection.Reader.ModuleReader.ResolveAssemblyRefImpl (IKVM.Reflection.Metadata.AssemblyRefTable+Record& rec) [0x00095] in <65ad872b0e564119b94b07e7497063eb>:0
at IKVM.Reflection.Reader.ModuleReader.ResolveAssemblyRef (System.Int32 index) [0x0002e] in <65ad872b0e564119b94b07e7497063eb>:0
at IKVM.Reflection.Reader.ModuleReader.ResolveType (System.Int32 metadataToken, IKVM.Reflection.IGenericContext context) [0x000d2] in <65ad872b0e564119b94b07e7497063eb>:0
at IKVM.Reflection.Reader.TypeDefImpl.get_BaseType () [0x0002f] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.MetadataImporter.CreateType (IKVM.Reflection.Type type, Mono.CSharp.TypeSpec declaringType, Mono.CSharp.MetadataImporter+DynamicTypeReader dtype, System.Boolean canImportBaseType) [0x0037f] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.MetadataImporter.ImportTypes (IKVM.Reflection.Type[] types, Mono.CSharp.Namespace targetNamespace, System.Boolean importExtensionTypes) [0x0005a] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.StaticImporter.ImportAssembly (IKVM.Reflection.Assembly assembly, Mono.CSharp.RootNamespace targetNamespace) [0x0000f] in <65ad872b0e564119b94b07e7497063eb>:0
--- End of inner exception stack trace ---
at Mono.CSharp.StaticImporter.ImportAssembly (IKVM.Reflection.Assembly assembly, Mono.CSharp.RootNamespace targetNamespace) [0x00054] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.StaticLoader.LoadReferences (Mono.CSharp.ModuleContainer module) [0x0009a] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.Driver.Compile () [0x0022e] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00052] in <65ad872b0e564119b94b07e7497063eb>:0
[ERROR] FATAL UNHANDLED EXCEPTION: Mono.CSharp.InternalErrorException: Failed to import assembly `System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.ArgumentException: Value does not fall within the expected range.
at IKVM.Reflection.Fusion.CompareAssemblyIdentityPure (System.String assemblyIdentity1, System.Boolean unified1, System.String assemblyIdentity2, System.Boolean unified2, IKVM.Reflection.AssemblyComparisonResult& result) [0x000e3] in <65ad872b0e564119b94b07e7497063eb>:0
at IKVM.Reflection.Universe.CompareAssemblyIdentity (System.String assemblyIdentity1, System.Boolean unified1, System.String assemblyIdentity2, System.Boolean unified2, IKVM.Reflection.AssemblyComparisonResult& result) [0x0001c] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.StaticLoader.AssemblyReferenceResolver (System.Object sender, IKVM.Reflection.ResolveEventArgs args) [0x0004b] in <65ad872b0e564119b94b07e7497063eb>:0
at IKVM.Reflection.Universe.Load (System.String refname, IKVM.Reflection.Module requestingModule, System.Boolean throwOnError) [0x00060] in <65ad872b0e564119b94b07e7497063eb>:0
at IKVM.Reflection.Reader.ModuleReader.ResolveAssemblyRefImpl (IKVM.Reflection.Metadata.AssemblyRefTable+Record& rec) [0x00095] in <65ad872b0e564119b94b07e7497063eb>:0
at IKVM.Reflection.Reader.ModuleReader.ResolveAssemblyRef (System.Int32 index) [0x0002e] in <65ad872b0e564119b94b07e7497063eb>:0
at IKVM.Reflection.Reader.ModuleReader.ResolveType (System.Int32 metadataToken, IKVM.Reflection.IGenericContext context) [0x000d2] in <65ad872b0e564119b94b07e7497063eb>:0
at IKVM.Reflection.Reader.TypeDefImpl.get_BaseType () [0x0002f] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.MetadataImporter.CreateType (IKVM.Reflection.Type type, Mono.CSharp.TypeSpec declaringType, Mono.CSharp.MetadataImporter+DynamicTypeReader dtype, System.Boolean canImportBaseType) [0x0037f] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.MetadataImporter.ImportTypes (IKVM.Reflection.Type[] types, Mono.CSharp.Namespace targetNamespace, System.Boolean importExtensionTypes) [0x0005a] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.StaticImporter.ImportAssembly (IKVM.Reflection.Assembly assembly, Mono.CSharp.RootNamespace targetNamespace) [0x0000f] in <65ad872b0e564119b94b07e7497063eb>:0
--- End of inner exception stack trace ---
at Mono.CSharp.StaticImporter.ImportAssembly (IKVM.Reflection.Assembly assembly, Mono.CSharp.RootNamespace targetNamespace) [0x00054] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.StaticLoader.LoadReferences (Mono.CSharp.ModuleContainer module) [0x0009a] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.Driver.Compile () [0x0022e] in <65ad872b0e564119b94b07e7497063eb>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00052] in <65ad872b0e564119b94b07e7497063eb>:0
Tool /usr/lib64/mono/4.5/mcs.exe execution finished.
</pre>
/usr/lib64/mono/xbuild/14.0/bin/Microsoft.CSharp.targets: error : Compiler crashed with code: 1.
<br />
<a href="https://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute.aspx">https://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute.aspx</a>
</body>
</html>