1
+ <Project >
2
+
3
+ <!-- Windows permissions means that users can't even see the directory $(SystemRoot)System32\config -->
4
+ <PropertyGroup Condition =" '$(OS)' != 'Unix' AND Exists('$(SystemRoot)\System32\config\system')" >
5
+ <IsAdministrator >true</IsAdministrator >
6
+ <DelaySign >true</DelaySign >
7
+ <PublicSign >false</PublicSign >
8
+ </PropertyGroup >
9
+
10
+ <Target Name =" NGenWindowsBinaries"
11
+ AfterTargets =" AfterBuild"
12
+ Condition =" '$(OS)' != 'Unix' AND
13
+ $(TargetFramework.StartsWith('net4')) AND
14
+ '$(NGenBinary)' == 'true' AND
15
+ Exists('$(TargetPath)') " >
16
+ <PropertyGroup >
17
+ <PathToNGen64 >$(windir)\Microsoft.NET\Framework64\v4.0.30319\ngen.exe</PathToNGen64 >
18
+ <PathToNGen32 >$(windir)\Microsoft.NET\Framework\v4.0.30319\ngen.exe</PathToNGen32 >
19
+ <PathToSN32 >$(WindowsSDK_ExecutablePath_x86)sn.exe</PathToSN32 >
20
+ </PropertyGroup >
21
+
22
+ <!--
23
+ Enable Skip Verification and then NGen for both 32 and 64 bit product.
24
+ If compiling use the app config file, if present.
25
+ -->
26
+ <Exec Command =' "$(PathToSN32)" /Vr "$(TargetPath)"' Condition = " Exists('$(PathToSN32)') AND Exists('$(TargetPath)') AND '$(IsAdministrator)' == 'true'" />
27
+
28
+ <Exec Command =' "$(PathToNGen64)" install "$(TargetPath)" /ExeConfig:$(TargetPath)' Condition = " Exists('$(PathToNGen64)') AND '$(PlatformTarget)' != 'x86' AND Exists('$(TargetPath).config') AND '$(IsAdministrator)' == 'true'" />
29
+ <Exec Command =' "$(PathToNGen32)" install "$(TargetPath)" /ExeConfig:$(TargetPath)' Condition = " Exists('$(PathToNGen32)') AND '$(PlatformTarget)' != 'x64' AND Exists('$(TargetPath).config') AND '$(IsAdministrator)' == 'true'" />
30
+ <Exec Command =' "$(PathToNGen64)" install "$(TargetPath)"' Condition = " Exists('$(PathToNGen64)') AND '$(PlatformTarget)' != 'x86' AND (!Exists('$(TargetPath).config')) AND '$(IsAdministrator)' == 'true' " />
31
+ <Exec Command =' "$(PathToNGen32)" install "$(TargetPath)"' Condition = " Exists('$(PathToNGen32)') AND '$(PlatformTarget)' != 'x64' AND (!Exists('$(TargetPath).config')) AND '$(IsAdministrator)' == 'true' " />
32
+ </Target >
33
+ </Project >
0 commit comments