Skip to content

Commit e5572d1

Browse files
Add F# Project (xamarin#1181)
1 parent 2e5c2c1 commit e5572d1

13 files changed

+123
-8
lines changed

Directory.Build.props

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33

4-
<PropertyGroup>
4+
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
55
<LangVersion>9.0</LangVersion>
66
<Nullable>enable</Nullable>
77
<WarningsAsErrors>nullable</WarningsAsErrors>
88
</PropertyGroup>
99

10-
1110
<PropertyGroup>
1211
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Xamarin.CommunityToolkit.ruleset</CodeAnalysisRuleSet>
1312
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>

azure-pipelines.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ variables:
1616
PathToCommunityToolkitUnitTestCsproj: 'src/CommunityToolkit/Xamarin.CommunityToolkit.UnitTests/Xamarin.CommunityToolkit.UnitTests.csproj'
1717
PathToMarkupUnitTestCsproj: 'src/Markup/Xamarin.CommunityToolkit.Markup.UnitTests/Xamarin.CommunityToolkit.Markup.UnitTests.csproj'
1818
PathToMsBuildOnMacOS: 'mono /Applications/Visual\ studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/MSBuild.dll'
19-
PathToSln: 'samples/XCT.Sample.sln'
2019

2120
resources:
2221
repositories:
@@ -68,12 +67,12 @@ jobs:
6867
- task: MSBuild@1
6968
displayName: 'Clean Solution'
7069
inputs:
71-
solution: $(PathToSln)
70+
solution: $(PathToSamplesSln)
7271
msbuildArguments: '/t:Clean'
7372
- task: MSBuild@1
7473
displayName: Build Solution
7574
inputs:
76-
solution: $(PathToSln)
75+
solution: $(PathToSamplesSln)
7776
configuration: Release
7877
msbuildArguments: '/restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
7978

@@ -104,7 +103,7 @@ jobs:
104103
- task: MSBuild@1
105104
displayName: 'Clean Solution'
106105
inputs:
107-
solution: $(PathToSln)
106+
solution: $(PathToSamplesSln)
108107
msbuildArguments: '/t:Clean'
109108
# if this is a tagged build, then update the version number
110109
- powershell: |

samples/XCT.Sample.Android/Properties/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.xamarincommunitytoolkitsample" android:installLocation="auto">
3-
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
3+
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" />
44
<application android:label="XamarinCommunityToolkitSample.Android"></application>
55
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
66
<uses-permission android:name="android.permission.INTERNET" />

samples/XCT.Sample.Android/Xamarin.CommunityToolkit.Sample.Android.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
1717
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
1818
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
19-
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
19+
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
2020
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
2121
<AndroidUseAapt2>true</AndroidUseAapt2>
2222
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>

samples/XCT.Sample.FSharp/About.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This project was added to ensure Xamarin.CommunityToolkit support for F#
2+
3+
Specifically, in an earilier version of Xamarin.CommunityToolkit, it was reported that F# projects couldn't use the Xamarin.CommunityToolkit NuGet package: https://github.com/xamarin/XamarinCommunityToolkit/commit/e569ee3a2f4cabaffdcfad11edbc2ef495cbe51b
4+
5+
This project ensures that all future releases of Xamarin.CommunityToolkit will continue to be compatible with F#.

samples/XCT.Sample.FSharp/App.fs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Temp
2+
3+
open Xamarin.Forms
4+
5+
type App() =
6+
inherit Application()
7+
8+
let stack = StackLayout(VerticalOptions = LayoutOptions.Center)
9+
let label = Label(XAlign = TextAlignment.Center, Text = "Welcome to F# Xamarin.Forms!")
10+
do
11+
stack.Children.Add(label)
12+
base.MainPage <- ContentPage(Content = stack)

samples/XCT.Sample.FSharp/App.xaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Temp.App">
3+
<Application.Resources>
4+
<!-- Application resource dictionary -->
5+
</Application.Resources>
6+
</Application>

samples/XCT.Sample.FSharp/App.xaml.fs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Temp
2+
3+
open Xamarin.Forms
4+
5+
type App() =
6+
inherit Application(MainPage = MainPage())
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace Temp
2+
open System.Reflection
3+
open System.Runtime.CompilerServices
4+
5+
[<assembly: AssemblyTitle("Temp")>]
6+
[<assembly: AssemblyDescription("")>]
7+
[<assembly: AssemblyConfiguration("")>]
8+
[<assembly: AssemblyCompany("")>]
9+
[<assembly: AssemblyProduct("")>]
10+
[<assembly: AssemblyCopyright("${AuthorCopyright}")>]
11+
[<assembly: AssemblyTrademark("")>]
12+
13+
// The assembly version has the format {Major}.{Minor}.{Build}.{Revision}
14+
15+
[<assembly: AssemblyVersion("1.0.0.0")>]
16+
17+
//[<assembly: AssemblyDelaySign(false)>]
18+
//[<assembly: AssemblyKeyFile("")>]
19+
20+
()
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Temp" x:Class="Temp.MainPage">
3+
<Label Text="Welcome to Xamarin Forms!" VerticalOptions="Center" HorizontalOptions="Center" />
4+
</ContentPage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Temp
2+
3+
open Xamarin.Forms
4+
open Xamarin.Forms.Xaml
5+
6+
type MainPage() =
7+
inherit ContentPage()
8+
let _ = base.LoadFromXaml(typeof<MainPage>)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Microsoft.NET.Sdk">
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<EmbeddedResource Include="MainPage.xaml">
10+
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
11+
</EmbeddedResource>
12+
<Compile Include="MainPage.xaml.fs">
13+
<DependentUpon>MainPage.xaml</DependentUpon>
14+
<SubType>Code</SubType>
15+
</Compile>
16+
<EmbeddedResource Include="App.xaml" />
17+
<Compile Include="App.xaml.fs">
18+
<DependentUpon>App.xaml</DependentUpon>
19+
<SubType>Code</SubType>
20+
</Compile>
21+
<Compile Include="AssemblyInfo.fs" />
22+
<None Include="About.txt" />
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<PackageReference Include="FSharp.Core" Version="5.0.1" />
27+
<ProjectReference Include="..\..\src\CommunityToolkit\Xamarin.CommunityToolkit\Xamarin.CommunityToolkit.csproj" />
28+
</ItemGroup>
29+
30+
</Project>

samples/XCT.Sample.sln

+26
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.CommunityToolkit.Ma
3333
EndProject
3434
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.CommunityToolkit.Markup.UnitTests", "..\src\Markup\Xamarin.CommunityToolkit.Markup.UnitTests\Xamarin.CommunityToolkit.Markup.UnitTests.csproj", "{AAE423C4-E9B4-434E-885C-2164C12BF79C}"
3535
EndProject
36+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Xamarin.CommunityToolkit.Sample.FSharp", "XCT.Sample.FSharp\Xamarin.CommunityToolkit.Sample.FSharp.fsproj", "{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}"
37+
EndProject
3638
Global
3739
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3840
Debug|Any CPU = Debug|Any CPU
@@ -327,6 +329,30 @@ Global
327329
{AAE423C4-E9B4-434E-885C-2164C12BF79C}.Release|x64.Build.0 = Release|Any CPU
328330
{AAE423C4-E9B4-434E-885C-2164C12BF79C}.Release|x86.ActiveCfg = Release|Any CPU
329331
{AAE423C4-E9B4-434E-885C-2164C12BF79C}.Release|x86.Build.0 = Release|Any CPU
332+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
333+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Debug|Any CPU.Build.0 = Debug|Any CPU
334+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Debug|ARM.ActiveCfg = Debug|Any CPU
335+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Debug|ARM.Build.0 = Debug|Any CPU
336+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Debug|iPhone.ActiveCfg = Debug|Any CPU
337+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Debug|iPhone.Build.0 = Debug|Any CPU
338+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
339+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
340+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Debug|x64.ActiveCfg = Debug|Any CPU
341+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Debug|x64.Build.0 = Debug|Any CPU
342+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Debug|x86.ActiveCfg = Debug|Any CPU
343+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Debug|x86.Build.0 = Debug|Any CPU
344+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|Any CPU.ActiveCfg = Release|Any CPU
345+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|Any CPU.Build.0 = Release|Any CPU
346+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|ARM.ActiveCfg = Release|Any CPU
347+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|ARM.Build.0 = Release|Any CPU
348+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|iPhone.ActiveCfg = Release|Any CPU
349+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|iPhone.Build.0 = Release|Any CPU
350+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
351+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
352+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|x64.ActiveCfg = Release|Any CPU
353+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|x64.Build.0 = Release|Any CPU
354+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|x86.ActiveCfg = Release|Any CPU
355+
{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|x86.Build.0 = Release|Any CPU
330356
EndGlobalSection
331357
GlobalSection(SolutionProperties) = preSolution
332358
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)