This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
/
UpdateTemplates.ps1
52 lines (48 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
$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="EnvDTE"
#><#@ 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 =
'EFDesigner',
'EF6Designer',
'EFCoreDesigner',
'EF6ModelGenerator',
'EFCore2ModelGenerator',
'EFCore3ModelGenerator',
'EFCore5ModelGenerator',
'EFCoreModelGenerator',
'EFModelFileManager',
'EFModelGenerator',
'VSIntegration',
'MultipleOutputHelper'
foreach ($f in $files) {
try {
[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"
}
}