-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFSharp.Android.Resource.targets
45 lines (40 loc) · 2.5 KB
/
FSharp.Android.Resource.targets
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
<Project>
<PropertyGroup>
<!-- Force both .NET Fx and .NET 6.0 to output the Resource.designer.cs file at the same place -->
<AndroidResgenFile>Resources/Resource.designer.cs</AndroidResgenFile>
<AndroidUseIntermediateDesignerFile>false</AndroidUseIntermediateDesignerFile>
<!-- Suffix ".Resource" to the assembly name of the project we're building for -->
<!-- .NET Fx and .NET 6.0 have slightly different paths -->
<FSharpAndroidResource_AssemblyName>$(AssemblyName).Resource</FSharpAndroidResource_AssemblyName>
<FSharpAndroidResource_AssemblyFolder>obj/$(Configuration)/</FSharpAndroidResource_AssemblyFolder>
<FSharpAndroidResource_AssemblyFolder Condition=" '$(TargetFramework)' != '' AND $(TargetFramework.StartsWith('monoandroid')) == false ">obj/$(Configuration)/$(TargetFramework)/</FSharpAndroidResource_AssemblyFolder>
<FSharpAndroidResource_AssemblyPath>$(FSharpAndroidResource_AssemblyFolder)$(AssemblyName).Resource.dll</FSharpAndroidResource_AssemblyPath>
<FSharpAndroidResource_AssemblyExists Condition=' Exists($(FSharpAndroidResource_AssemblyPath)) '>true</FSharpAndroidResource_AssemblyExists>
</PropertyGroup>
<ItemGroup Condition=" '$(FSharpAndroidResource_AssemblyExists)' == 'true' ">
<Reference Include="$(FSharpAndroidResource_AssemblyName)">
<HintPath>$(FSharpAndroidResource_AssemblyPath)</HintPath>
</Reference>
</ItemGroup>
<Target
Name="CompileResourceDesignerForFSharp"
BeforeTargets="CoreCompile"
DependsOnTargets="ResolveProjectReferences;ResolveAssemblyReferences;UpdateAndroidResources"
Inputs="$(AndroidResgenFile)"
Outputs="$(FSharpAndroidResource_AssemblyPath)">
<Error Condition="$(TargetFramework.StartsWith('net')) AND $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '8'))"
Text="Please remove FSharp.Android.Resource from your project. It is no longer needed in .NET 8.0 and higher." />
<!-- Compile Resource.designer.cs into a dll -->
<Csc
Sources="$(AndroidResgenFile)"
OutputAssembly="$(FSharpAndroidResource_AssemblyPath)"
NoConfig="true"
NoStandardLib="true"
NoLogo="true"
Platform="$(Platform)"
References="@(_ResolveAssemblyReferenceResolvedFiles)"
TargetType="library"
UseHostCompilerIfAvailable="true"
Optimize="$(Optimize)" />
</Target>
</Project>