forked from msawczyn/EFDesigner2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpdateTemplates.ps1
55 lines (49 loc) · 1.78 KB
/
UpdateTemplates.ps1
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
$search = '(?s)^.*#region Template[\r\n]+(.+)#endregion Template.*$'
$replace = '<#@ include file="EF6ModelGenerator.ttinclude" once="true"
#><#@ include file="EFCore2ModelGenerator.ttinclude" once="true"
#><#@ include file="EFCore3ModelGenerator.ttinclude" once="true"
#><#@ include file="EFCore5ModelGenerator.ttinclude" once="true"
#><#@ include file="EFCoreModelGenerator.ttinclude" once="true"
#><#@ include file="EFModelFileManager.ttinclude" once="true"
#><#@ include file="EFModelGenerator.ttinclude" once="true"
#><#@ include file="VSIntegration.ttinclude" once="true"
#><#@ assembly name="System.Core"
#><#@ assembly name="System.Data.Linq"
#><#@ assembly name="System.Xml"
#><#@ assembly name="System.Xml.Linq"
#><#@ import namespace="System"
#><#@ import namespace="System.IO"
#><#@ import namespace="System.Globalization"
#><#@ import namespace="System.Linq"
#><#@ import namespace="System.Security"
#><#@ import namespace="System.Text"
#><#@ import namespace="System.Collections.Generic"
#><#@ import namespace="System.Diagnostics.CodeAnalysis"
#><#@ import namespace="EnvDTE"
#><#@ import namespace="System.Data.Entity.Design.PluralizationServices"
#><#@ import namespace="Microsoft.VisualStudio.TextTemplating"
#><#+
$1
#>'
$files =
'EF6Designer',
'EF6ModelGenerator',
'EFCore2ModelGenerator',
'EFCore3ModelGenerator',
'EFCore5ModelGenerator',
'EFCoreDesigner',
'EFCoreModelGenerator',
'EFDesigner',
'EFModelFileManager',
'EFModelGenerator',
'MultipleOutputHelper',
'VSIntegration'
foreach ($f in $files) {
try {
"Processing $f"
[regex]::Replace((get-content src\DslPackage\TextTemplates\EditingOnly\$f.cs -Raw), $search, $replace) | set-content src\DslPackage\TextTemplates\$f.ttinclude
} catch {
"** Did not process $f"
}
}
"Done"