forked from getsentry/sentry-unity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Directory.Build.props
50 lines (46 loc) · 2.86 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
<Project>
<PropertyGroup>
<Version>0.9.1</Version>
<LangVersion>9</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDependencyFile>false</GenerateDependencyFile>
<DevPackageFolderName>package-dev</DevPackageFolderName>
<Deterministic>true</Deterministic>
<Features>strict</Features>
<!-- Must be set here but will be overwritten below once the UnityVersion is ±resolved -->
<!-- When using Unity 2022 the default will change to netstandard2.1 -->
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<Target Name="ResetTargetFrameworks" AfterTargets="FindUnity" BeforeTargets="BeforeResolveReferences">
<!-- With 2022 Unity packages are already targeting ns2.1 and Unity itself only has that as an option so we must target ns2.1 here too: -->
<PropertyGroup Condition="$(UnityVersion.StartsWith('2022'))">
<TargetFrameworks>netstandard2.1</TargetFrameworks>
</PropertyGroup>
<!-- Lowest version supported at this time is 2019 and up to 2021 ns2.0 is the only option. -->
<PropertyGroup Condition="$(UnityVersion.StartsWith('2019')) or $(UnityVersion.StartsWith('2020')) or $(UnityVersion.StartsWith('2021'))">
<TargetFrameworks>netstandard2.0</TargetFrameworks>
</PropertyGroup>
<!-- Being specific on which Unity version we support allows us to quickly ajust these settings when adding support to new editors.
Future 2022 or 2023 versions likely will target net6.0 so not rolling forward. Instead break the build here. -->
<Message Condition="'$(MSBuildProjectName)' == 'Sentry.Unity'" Text="Selected TFM: $(TargetFrameworks) for Unity version $(UnityVersion)" Importance="High" />
</Target>
<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" AfterTargets="FindUnity" BeforeTargets="BeforeResolveReferences">
<Error Condition="'$(UnityManagedPath)' == ''" Text="'UnityManagedPath' not defined. Can't find UnityEngine.dll."></Error>
<Error Condition="!Exists('$(UnityManagedPath)/UnityEngine.dll')" Text="Couldn't find UnityEngine at $(UnityManagedPath)/UnityEngine.dll."></Error>
<ItemGroup>
<Reference Include="UnityEngine">
<HintPath>$(UnityManagedPath)/UnityEngine.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
</Target>
</Project>