How to check if ArSim is activated during build

Hello everyone,

Does anyone know if there is a way to check whether ArSim is activated or not during build events?

An example with Powershell

Pre-Build Step:

Powershell.exe -executionpolicy remotesigned -Command "& "'$(WIN32_AS_PROJECT_PATH)/Logical/BuildScripts/GetArSimStatus.ps1'" -ProjectPath '$(WIN32_AS_PROJECT_PATH)' -BuildConfiguration '$(AS_CONFIGURATION)'"

The script GetArSimStatus.ps1:

Param (
	[Parameter(Mandatory = $false, HelpMessage = 'Use $(WIN32_AS_PROJECT_PATH) in AS settings.')][string]$ProjectPath,
	[Parameter(Mandatory = $false, HelpMessage = 'Use $(AS_CONFIGURATION) in AS settings.')][string]$BuildConfiguration
)

# XPath Definition
 $xPathIP = "//ns:Hardware//ns:Parameter[@ID='Simulation']"

 # Hardware.hw Datei parsen und Simulationsbit auslesen
[xml]$xml = Get-Content -Path $([System.IO.Path]::Combine($ProjectPath, "Physical", $BuildConfiguration, 'Hardware.hw'))
$ns = New-Object System.Xml.XmlNamespaceManager($xml.NameTable)
$ns.AddNamespace("ns", $xml.DocumentElement.NamespaceURI)
try {
	$Simulation = [bool]$xml.SelectSingleNode($xPathIP, $ns).Value
	if ($Simulation) {
		Write-Output "Simulation aktiviert"
	}
	else {
        Write-Output "Simulation deaktiviert"
    }
}
catch {
	Write-Warning "Fehler beim Auslesen der Hardware.hw Datei."
}

The output

4 Likes