@@ -25,6 +25,12 @@ public class WizardImplementation : IWizard
2525 private const string RuntimeDebug = "$rtdebug$" ;
2626 private const string RuntimeRelease = "$rtrelease$" ;
2727 private const string RunSilent = "$runsilent$" ;
28+ private const string ARM64DebugPlatform = "$arm64debugplatform$" ;
29+ private string arm64DebugXMLChunk = " <ItemDefinitionGroup Condition=\" '$(Configuration)|$(Platform)'=='Debug|ARM64'\" > <ClCompile> <PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>ARM64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>$rtdebug$</RuntimeLibrary> <WarningLevel>Level3</WarningLevel> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> </Link> </ItemDefinitionGroup>" ;
30+ private const string ARM64ReleasePlatform = "$arm64releaseplatform$" ;
31+ private string arm64ReleaseXMLChunk = " <ItemDefinitionGroup Condition=\" '$(Configuration)|$(Platform)'=='Release|ARM64'\" > <ClCompile> <PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <PreprocessorDefinitions>ARM64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>$rtrelease$</RuntimeLibrary> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> </Link> </ItemDefinitionGroup>" ;
32+ private const string ARM64Config = "$arm64config$" ;
33+ private string arm64ConfigXML = "<ProjectConfiguration Include=\" Debug|ARM64\" > <Configuration>Debug</Configuration> <Platform>ARM64</Platform> </ProjectConfiguration> <ProjectConfiguration Include=\" Release|ARM64\" > <Configuration>Release</Configuration> <Platform>ARM64</Platform> </ProjectConfiguration>" ;
2834 private List < Project > projects = new List < Project > ( ) ;
2935 private int selectedProjectIndex ;
3036 private IWizard nugetWizard ;
@@ -176,6 +182,16 @@ public void RunStarted(object automationObject,
176182 . Select ( moniker => TryParsePlatformVersion ( moniker ) )
177183 . Where ( name => name != null )
178184 . OrderByDescending ( p => p . Version ) . ToList ( ) ;
185+
186+ if ( ! this . IsARM64 ( ) ) {
187+ arm64DebugXMLChunk = "" ;
188+ arm64ReleaseXMLChunk = "" ;
189+ arm64ConfigXML = "" ;
190+ }
191+ replacementsDictionary [ ARM64Config ] = arm64ConfigXML ;
192+ replacementsDictionary [ ARM64DebugPlatform ] = arm64DebugXMLChunk ;
193+ replacementsDictionary [ ARM64ReleasePlatform ] = arm64ReleaseXMLChunk ;
194+
179195 Platform latestPlatform = allPlatformsForLatestSdk . FirstOrDefault ( ) ;
180196
181197 if ( latestPlatform == null )
@@ -195,6 +211,16 @@ public void RunStarted(object automationObject,
195211 }
196212 }
197213
214+ /// <summary>
215+ /// Checks architecture of Visual Studio Process.
216+ /// </summary>
217+ /// <returns>boolean indicating if running arm64 VS</returns>
218+ protected bool IsARM64 ( ) {
219+ string cpu = System . Environment . GetEnvironmentVariable ( "PROCESSOR_ARCHITECTURE" , EnvironmentVariableTarget . Process ) ;
220+
221+ return cpu . Equals ( "ARM64" , StringComparison . OrdinalIgnoreCase ) ;
222+ }
223+
198224 // This method is only called for item templates,
199225 // not for project templates.
200226 public bool ShouldAddProjectItem ( string filePath )
0 commit comments