-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathXrayUI-dev.csproj
More file actions
183 lines (168 loc) · 9.61 KB
/
Copy pathXrayUI-dev.csproj
File metadata and controls
183 lines (168 loc) · 9.61 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net10.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>XrayUI</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<WinUISDKReferences>false</WinUISDKReferences>
<EnableMsixTooling>true</EnableMsixTooling>
<!-- PRI fallback target when the system locale has no matching Strings/{lang}/Resources.resw.
Keeps non-zh/en users (ko/ja/ru/...) on English rather than relying on PRI's
alphabetical default. -->
<DefaultLanguage>en-US</DefaultLanguage>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<WindowsPackageType>None</WindowsPackageType>
</PropertyGroup>
<ItemGroup>
<!-- Keep engine + rules out of MSIX packaging but copy them to the output directory -->
<Content Remove="Assets\engine\wintun.dll" />
<Content Remove="Assets\engine\xray.exe" />
<Content Remove="Assets\engine\arm64\wintun.dll" />
<Content Remove="Assets\engine\arm64\xray.exe" />
<Content Remove="Assets\rules\geoip.dat" />
<Content Remove="Assets\rules\geosite.dat" />
</ItemGroup>
<!-- The standalone Updater is a Rust project (updater-rs); built via the
PublishUpdaterAlongside target below. Keep its sources and (large) Cargo
target/ dir out of the C# build's default file globs. -->
<ItemGroup>
<Compile Remove="updater-rs\**" />
<Content Remove="updater-rs\**" />
<None Remove="updater-rs\**" />
<Page Remove="updater-rs\**" />
<ApplicationDefinition Remove="updater-rs\**" />
</ItemGroup>
<!-- The unit test project (XrayUI.Tests) nests inside this project's root;
keep its sources out of the app's default globs the same way updater-rs is. -->
<ItemGroup>
<Compile Remove="XrayUI.Tests\**" />
<Content Remove="XrayUI.Tests\**" />
<None Remove="XrayUI.Tests\**" />
<Page Remove="XrayUI.Tests\**" />
<ApplicationDefinition Remove="XrayUI.Tests\**" />
</ItemGroup>
<ItemGroup>
<!-- Default engine binaries (x64). Used for empty RID (`dotnet build` / BuildAndRun.ps1)
and explicit -r win-x64 publishes. Explicit form avoids silently matching
any future RID we haven't accounted for. -->
<None Include="Assets\engine\xray.exe" Condition="'$(RuntimeIdentifier)' == 'win-x64' or '$(RuntimeIdentifier)' == ''">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Assets\engine\wintun.dll" Condition="'$(RuntimeIdentifier)' == 'win-x64' or '$(RuntimeIdentifier)' == ''">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<!-- ARM64 override: Link= flattens them to Assets/engine/ in the output so
XrayService/TunService's hard-coded paths stay unchanged. -->
<None Include="Assets\engine\arm64\xray.exe" Link="Assets\engine\xray.exe" Condition="'$(RuntimeIdentifier)' == 'win-arm64'">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Assets\engine\arm64\wintun.dll" Link="Assets\engine\wintun.dll" Condition="'$(RuntimeIdentifier)' == 'win-arm64'">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Assets\rules\geoip.dat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Assets\rules\geosite.dat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
<!--
Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
Tools extension to be activated for this project even if the Windows App SDK Nuget
package has not yet been restored.
-->
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.2.251219" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.28000.1839" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="2.0.1" />
<!-- Promote these two transitive deps of WindowsAppSDK to direct references so we can
strip their runtime assets (DirectML.dll / onnxruntime.dll / Microsoft.Windows.AI.MachineLearning.dll).
IncludeAssets=compile keeps the reference assemblies for compile-time use; PrivateAssets=all
prevents them from flowing to consumers. -->
<!-- Pinned exact: floating "2.0.*" caused intermittent restore-time mismatches with
Microsoft.WindowsAppSDK 2.0.1's transitive Foundation/InteractiveExperiences
expectations. Bump deliberately when WindowsAppSDK itself is upgraded. -->
<PackageReference Include="Microsoft.WindowsAppSDK.AI" Version="2.0.185">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>compile</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.AI.MachineLearning" Version="2.0.300">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>compile</IncludeAssets>
</PackageReference>
<PackageReference Include="WinUIEx" Version="2.9.1" />
<!-- Clash YAML import: parsed via YamlDotNet's reflection-free RepresentationModel
(YamlStream) only — never the typed Deserializer — to stay AOT/trim-safe. -->
<PackageReference Include="YamlDotNet" Version="18.0.0" />
</ItemGroup>
<!--
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
Explorer "Package and Publish" context menu entry to be enabled for this project even if
the Windows App SDK Nuget package has not yet been restored.
-->
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>
<!-- Publish Properties -->
<PropertyGroup>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishTrimmed>False</PublishTrimmed>
<ApplicationIcon>Assets\Icons\output.ico</ApplicationIcon>
</PropertyGroup>
<!-- Version: defaults for local builds; CI overrides via -p:Version=<tag> -->
<PropertyGroup>
<Version Condition="'$(Version)' == ''">0.0.0-dev</Version>
</PropertyGroup>
<!-- Auto-update channel marker. release.yml publishes two variants per RID:
plain zips (WindowsAppSDKSelfContained=false, Windows App Runtime must be
installed) and "-wasdk" zips (=true, runtime bundled into the app folder).
Derived from the same -p:WindowsAppSDKSelfContained the publish already
passes, so the binary and the zip it was packed into can never disagree.
UpdateService.cs uses this to request the matching release asset — the
updater only overwrites files, so a cross-variant update would leave a
framework-dependent exe stranded on machines without the runtime. -->
<PropertyGroup Condition="'$(WindowsAppSDKSelfContained)' == 'true'">
<DefineConstants>$(DefineConstants);WASDK_SELF_CONTAINED</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Content Update="Assets\Icons\output.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Assets\Icons\running.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<!-- Auto-build the standalone (Rust) Updater alongside the main app on local
`dotnet publish`, so testing the in-app upgrade flow doesn't require
running cargo by hand. CI bypasses this with -p:BuildingForCI=true
(it builds the updater explicitly to keep step logs separated).
Skipped when no RID is set (e.g. plain `dotnet build`). -->
<Target Name="PublishUpdaterAlongside" AfterTargets="Publish" Condition="'$(BuildingForCI)' != 'true' and '$(RuntimeIdentifier)' != ''">
<PropertyGroup>
<!-- RID -> Rust target triple. -->
<RustUpdaterTarget Condition="'$(RuntimeIdentifier)' == 'win-x64'">x86_64-pc-windows-msvc</RustUpdaterTarget>
<RustUpdaterTarget Condition="'$(RuntimeIdentifier)' == 'win-arm64'">aarch64-pc-windows-msvc</RustUpdaterTarget>
<RustUpdaterTarget Condition="'$(RuntimeIdentifier)' == 'win-x86'">i686-pc-windows-msvc</RustUpdaterTarget>
</PropertyGroup>
<Error Condition="'$(RustUpdaterTarget)' == ''" Text="No Rust target mapping for RuntimeIdentifier '$(RuntimeIdentifier)'. Add one to the PublishUpdaterAlongside target in XrayUI-dev.csproj." />
<!-- Always release-built (size-optimised, rarely debugged). Cargo can't emit a
dotted file name, so build xrayui-updater.exe and copy it to the contract
name XrayUI.Updater.exe that UpdateService.cs + shipped versions expect. -->
<Exec Command="cargo build --release --manifest-path "$(MSBuildThisFileDirectory)updater-rs\Cargo.toml" --bin xrayui-updater --target $(RustUpdaterTarget)" />
<Copy SourceFiles="$(MSBuildThisFileDirectory)updater-rs\target\$(RustUpdaterTarget)\release\xrayui-updater.exe" DestinationFiles="$(PublishDir)XrayUI.Updater.exe" />
<Message Text="Bundled XrayUI.Updater.exe (Rust, $(RustUpdaterTarget)) into $(PublishDir)" Importance="high" />
</Target>
</Project>