Repository navigation
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
64 lines (59 loc) · 5.37 KB
/
Copy pathDirectory.Build.targets
File metadata and controls
64 lines (59 loc) · 5.37 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
<Project>
<!-- Библиотеки ядра всегда собираются как AnyCPU (MSIL), чтобы сборка MAUI (x64) не ломала Avalonia/CLI (MSB3270) -->
<PropertyGroup Condition="'$(OutputType)' == 'Library'">
<PlatformTarget>AnyCPU</PlatformTarget>
<ProcessorArchitecture>msil</ProcessorArchitecture>
</PropertyGroup>
<!-- Строгая проверка обязательных метаданных перед сборкой -->
<Target Name="ValidateProjectMetadata" BeforeTargets="BeforeBuild">
<Error Condition="'$(VersionPrefix)' == ''"
Text="Не указан <VersionPrefix> в version.props!" />
<Error Condition="'$(Authors)' == ''"
Text="Не найден файл *.slnx в корне решения (поле <Authors> пустое). Создайте .slnx или задайте Authors в version.props!" />
<Error Condition="'$(Company)' == ''"
Text="Не указана <Company> в version.props!" />
<Error Condition="'$(IsPackable)' != 'false' and '$(PackageLicenseExpression)' == '' and '$(PackageLicenseFile)' == ''"
Text="Не указана лицензия проекта (<PackageLicenseExpression> или <PackageLicenseFile>)! Задайте её в .csproj или version.props." />
</Target>
<!-- Автоматическое открытие internal-членов для соответствующих сборок Tests и Benchmarks -->
<ItemGroup Condition="'$(IsPackable)' != 'false' and !$(MSBuildProjectName.EndsWith('.Tests')) and !$(MSBuildProjectName.EndsWith('.Benchmarks'))">
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>$(MSBuildProjectName).Tests</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>$(MSBuildProjectName).Benchmarks</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<!-- Локальное распределение сборок (MSIX / GooglePlay AAB+APK / EXE) через переменную PackageRoot -->
<PropertyGroup Condition="'$(IsWindows)' == 'true' and '$(DOTNET_RUNNING_IN_CONTAINER)' != 'true' and '$(CI)' != 'true' and '$(GITHUB_ACTIONS)' != 'true'">
<IsMauiProject Condition="'$(UseMaui)' == 'true' or $(MSBuildProjectName.EndsWith('.Maui'))">true</IsMauiProject>
<PackageMode Condition="'$(PackageMode)' == '' and '$(IsMauiProject)' == 'true'">MSIX</PackageMode>
<PackageMode Condition="'$(PackageMode)' == '' and '$(IsMauiProject)' != 'true'">None</PackageMode>
<AppxPackageDir Condition="'$(AppxPackageDir)' == '' and '$(PackageMode)' == 'MSIX'">$(PackageRoot)/AppPackages/$(MSBuildProjectName)/</AppxPackageDir>
<PublishDir Condition="'$(PublishDir)' == '' and $(TargetFramework.Contains('-android'))">$(PackageRoot)/GooglePlay/$(MSBuildProjectName)/</PublishDir>
<PublishDir Condition="'$(PublishDir)' == '' and '$(PackageMode)' == 'MSIX' and !$(TargetFramework.Contains('-android'))">$(PackageRoot)/Msix/$(MSBuildProjectName)/</PublishDir>
<PublishDir Condition="'$(PublishDir)' == '' and '$(PackageMode)' != 'MSIX' and !$(TargetFramework.Contains('-android')) and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe' or '$(IsTrimmable)' == 'true')">$(PackageRoot)/exe/$(MSBuildProjectName)/</PublishDir>
</PropertyGroup>
<Target Name="RedirectPublishDirToPackage"
Condition="'$(IsWindows)' == 'true' and '$(DOTNET_RUNNING_IN_CONTAINER)' != 'true' and '$(CI)' != 'true' and '$(GITHUB_ACTIONS)' != 'true'"
BeforeTargets="PrepareForPublish;ComputeAndCopyFilesToPublishDirectory;Publish">
<PropertyGroup>
<PublishDir Condition="'$(PublishDir)' == '' and $(TargetFramework.Contains('-android'))">$(PackageRoot)/GooglePlay/$(MSBuildProjectName)/</PublishDir>
<PublishDir Condition="'$(PublishDir)' == '' and '$(PackageMode)' == 'MSIX' and !$(TargetFramework.Contains('-android'))">$(PackageRoot)/Msix/$(MSBuildProjectName)/</PublishDir>
<PublishDir Condition="'$(PublishDir)' == '' and '$(PackageMode)' != 'MSIX' and !$(TargetFramework.Contains('-android')) and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe' or '$(IsTrimmable)' == 'true')">$(PackageRoot)/exe/$(MSBuildProjectName)/</PublishDir>
</PropertyGroup>
</Target>
<!-- Автосинхронизация версии в SVG-баннере из version.props -->
<Target Name="SyncSvgVersionFromProps"
BeforeTargets="BeforeBuild"
Condition="'$(MSBuildProjectName)' == 'obxodka.Client' and Exists('$(MSBuildThisFileDirectory).github\assets\animated_header.svg') and Exists('$(MSBuildThisFileDirectory)version.props')"
Inputs="$(MSBuildThisFileDirectory)version.props"
Outputs="$(MSBuildThisFileDirectory).github\assets\animated_header.svg">
<Exec Command="powershell -NoProfile -ExecutionPolicy Bypass -File "$(MSBuildThisFileDirectory)tools\sync_version_assets.ps1" -RootDir "$(MSBuildThisFileDirectory)""
Condition="'$(OS)' == 'Windows_NT'"
ContinueOnError="true" />
<Exec Command="pwsh -NoProfile -ExecutionPolicy Bypass -File "$(MSBuildThisFileDirectory)tools/sync_version_assets.ps1" -RootDir "$(MSBuildThisFileDirectory)""
Condition="'$(OS)' != 'Windows_NT'"
ContinueOnError="true" />
</Target>
</Project>