-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAssemblyInfo.tt
114 lines (99 loc) · 4.95 KB
/
AssemblyInfo.tt
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
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="Microsoft.Win32" #>
<#@ output extension=".cs" #>
<#
/************************ Filled with your project data *********************************/
// Names.
string projectName = "MyProjectName"; // Project (short name for COM).
string productName = "My Project Name"; // Full title.
string developerName = "Developer Name"; // Developer.
string assemblyType = "Application"; // Application, Library, etc.
// Version.
int majorVersion = 1;
int minorVersion = 0;
// Year of the start of work on the project.
string since = "2021";
/*****************************************************************************************/
DateTime today = DateTime.Today;
string years = today.ToString("yyyy");
string build = today.ToString("yyMM");
if (years != since) years = $"{since}-{years}";
int ver = 0;
int rnd = new Random().Next(10);
string guid;
string appIDguid;
using (RegistryKey verRegKey =
Registry.CurrentUser.CreateSubKey($"SOFTWARE\\{developerName}\\Development\\{projectName}\\{majorVersion}.{minorVersion}"))
{
string tmp = (string)verRegKey?.GetValue("Assembly", "0") ?? "0";
ver = Convert.ToInt32(tmp) + 1;
tmp = ver.ToString();
verRegKey?.SetValue("Assembly", tmp);
guid = (string)verRegKey?.GetValue("Guid", Guid.NewGuid().ToString()) ?? Guid.NewGuid().ToString();
verRegKey?.SetValue("Guid", guid);
appIDguid = (string)verRegKey?.GetValue("ApplicationID", Guid.NewGuid().ToString()) ?? Guid.NewGuid().ToString();
verRegKey?.SetValue("ApplicationID", appIDguid);
}
#>
/***********************************************************
<#= productName#> v. <#= majorVersion#>.<#= minorVersion#>
The MIT License (MIT)
Copyright: © <#= developerName#> <#= years #>.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall
be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
************************************************************/
#if COMVISIBLE
using System.EnterpriseServices;
#endif
using System.Reflection;
using System.Runtime.InteropServices;
// General information about this assembly is provided by the following set
// attributes. Change the values of these attributes to change the information,
// related to the assembly.
[assembly: AssemblyTitle("<#= productName#> <#=string.IsNullOrEmpty(assemblyType) ? "" : assemblyType + " "#><#= majorVersion#>.<#= minorVersion#>")] // Assembly name.
[assembly: AssemblyDescription("<#= productName#> <#= majorVersion#>.<#= minorVersion#><#=string.IsNullOrEmpty(assemblyType) ? "" : " " + assemblyType#>")] // Assembly description.
[assembly: AssemblyCompany("<#= developerName#>")] // Developer.
[assembly: AssemblyProduct("<#= developerName#> <#= productName#>")] // Product name.
[assembly: AssemblyCopyright("© <#= developerName#> <#= years #>")] // Copyright.
[assembly: AssemblyTrademark("<#= developerName#>® <#= productName#>®")] // Trademark.
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("<#= majorVersion#>.<#= minorVersion#>.<#= today.ToString("yyMM") #>.<#= $"{ver:0000}"#>")]
[assembly: AssemblyFileVersion("<#= majorVersion#>.<#= minorVersion#>.<#= today.ToString("yyMM") #>.<#= $"{ver:0000}"#>")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
// Setting ComVisible to False makes the types in this assembly invisible
// for COM components. If you need to refer to the type in this assembly via COM,
// set the ComVisible attribute to TRUE for this type.
#if COMVISIBLE
[assembly: ComVisible(true)]
[assembly: ApplicationName("<#= projectName#>")] // COM application name.
[assembly: ApplicationID("<#= appIDguid#>")]
#else
[assembly: ComVisible(false)]
#endif
// The following GUID serves to identify the type library if this project will be visible to COM
[assembly: Guid("<#= guid#>")]