-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Directory.Build.props
55 lines (49 loc) · 3.04 KB
/
Directory.Build.props
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
<Project>
<PropertyGroup>
<Version>2.3.0</Version>
<LangVersion>12</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDependencyFile>false</GenerateDependencyFile>
<DevPackageFolderName>package-dev</DevPackageFolderName>
<Deterministic>true</Deterministic>
<Features>strict</Features>
<SignAssembly>false</SignAssembly>
<!-- This is the default for our lowest supported version 2019 LTS: netstandard2.0 -->
<!-- The TargetFramework gets overridden depending on the UnityVersion here and in test/props -->
<TargetFramework>netstandard2.0</TargetFramework>
<!-- The RepoRoot gets used in the conditional propertygroup for finding the Unity version -->
<RepoRoot>$([System.IO.Path]::GetDirectoryName($([MSBuild]::GetPathOfFileAbove('.gitignore', '$(MSBuildThisFileDirectory)'))))/</RepoRoot>
</PropertyGroup>
<!-- With this it's possible for the local environment (i.e. CI) to override the version -->
<PropertyGroup Condition="$(UNITY_VERSION) != ''">
<UnityVersion>$(UNITY_VERSION)</UnityVersion>
</PropertyGroup>
<!-- If there is no Unity version in the environment we default to reading it from the settings of the samples project -->
<PropertyGroup Condition="$(UNITY_VERSION) == ''">
<UnitySampleProjectUnityVersion>$(RepoRoot)samples/unity-of-bugs/ProjectSettings/ProjectVersion.txt</UnitySampleProjectUnityVersion>
<ProjectSettingsFileContent>$([System.IO.File]::ReadAllText($(UnitySampleProjectUnityVersion)))</ProjectSettingsFileContent>
<UnityVersion>$([System.Text.RegularExpressions.Regex]::Match("$(ProjectSettingsFileContent)", ": +([^\s]+)").Groups[1].Value)</UnityVersion>
</PropertyGroup>
<!-- Starting with 2022 the UnityEngine targets netstandard2.1 -->
<PropertyGroup Condition="$(UnityVersion.StartsWith('2022')) Or $(UnityVersion.StartsWith('6000'))">
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Roslynator.Analyzers" Version="3.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.0" PrivateAssets="All" />
<PackageReference Include="Nullable" Version="1.3.0" PrivateAssets="All" />
</ItemGroup>
<!-- Add reference once we figure out where the DLL is (find Unity version and install location) -->
<Target Name="ReferenceUnity" DependsOnTargets="FindUnity" BeforeTargets="BeforeResolveReferences">
<Error Condition="'$(UnityManagedPath)' == ''" Text="'UnityManagedPath' not defined. Can't find UnityEngine.dll." />
<Error Condition="!Exists('$(UnityManagedPath)/UnityEngine.dll')" Text="Couldn't find UnityEngine at $(UnityManagedPath)/UnityEngine.dll." />
<ItemGroup>
<Reference Include="UnityEngine">
<HintPath>$(UnityManagedPath)/UnityEngine.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
</Target>
</Project>