Skip to content

Commit b56c6ab

Browse files
committed
build(KeyAsio): exclude main assembly from single file bundle
Add new target to exclude KeyASIO.dll from single file bundle while keeping it in publish directory. Also refactor secrets obfuscation to use FilesToBundle items instead of hardcoded path.
1 parent 88e0a2e commit b56c6ab

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

src/Apps/KeyAsio/KeyAsio.csproj

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,24 @@
112112
<Exec Command="pwsh -ExecutionPolicy Bypass -File &quot;$(MSBuildProjectDirectory)\..\..\Signer.ps1&quot; sign &quot;$(PublishDir)$(TargetFileName)&quot; &quot;$(MSBuildProjectDirectory)\keyasio_private.key&quot;" />
113113
</Target>
114114

115+
<Target Name="ExcludeMainAssemblyFromBundle" BeforeTargets="GenerateSingleFileBundle" Condition="'$(PublishSingleFile)' == 'true'">
116+
<ItemGroup>
117+
<MainAssemblyToExclude Include="@(FilesToBundle)" Condition="'%(Filename)%(Extension)' == 'KeyASIO.dll'" />
118+
</ItemGroup>
119+
<Message Text="Excluding main assembly from bundle and copying to publish dir: @(MainAssemblyToExclude)" Importance="High" />
120+
<Copy SourceFiles="@(MainAssemblyToExclude)" DestinationFolder="$(PublishDir)" />
121+
<ItemGroup>
122+
<FilesToBundle Remove="@(FilesToBundle)" Condition="'%(Filename)%(Extension)' == 'KeyASIO.dll'" />
123+
</ItemGroup>
124+
</Target>
125+
115126
<Target Name="ObfuscateSecretsInBundle" BeforeTargets="GenerateSingleFileBundle" Condition="'$(ConfuserExe)' != '' And '$(PublishSingleFile)' == 'true'">
116127
<Message Text="Obfuscating KeyAsio.Secrets.dll before bundling..." Importance="High" />
117-
<PropertyGroup>
118-
<SecretsDllPath>$(PublishDir)KeyAsio.Secrets.dll</SecretsDllPath>
119-
</PropertyGroup>
120-
<Exec Command="&quot;$(ConfuserExe)&quot; -file &quot;$(SecretsDllPath)&quot; -targetfile &quot;$(SecretsDllPath)&quot; -anti_debug 1 -hide_calls 1 -control_flow 1 -flow_level 9 -virtualization 1 -naming stealth" />
128+
<ItemGroup>
129+
<SecretsDllToObfuscate Include="@(FilesToBundle)" Condition="'%(Filename)%(Extension)' == 'KeyAsio.Secrets.dll'" />
130+
</ItemGroup>
131+
<Message Text="Found Secrets DLL at: @(SecretsDllToObfuscate)" Importance="High" />
132+
<Exec Command="&quot;$(ConfuserExe)&quot; -file &quot;%(SecretsDllToObfuscate.Identity)&quot; -targetfile &quot;%(SecretsDllToObfuscate.Identity)&quot; -anti_debug 1 -hide_calls 1 -control_flow 1 -flow_level 9 -virtualization 1 -naming stealth" Condition="'@(SecretsDllToObfuscate)' != ''" />
121133
</Target>
122134

123135
</Project>

0 commit comments

Comments
 (0)