Skip to content

Commit 61d8f7f

Browse files
Port Xamarin.Forms Sample to .NET MAUI (#129)
* Port Xamarin.Forms to .NET MAUI * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Add XML Comments * Fix XML Comments * `dotnet format` * Modify default template files * Build Release Config
1 parent bd273c0 commit 61d8f7f

137 files changed

Lines changed: 14140 additions & 1710 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Suppress: EC112
2+
# top-most EditorConfig file
3+
root = true
4+
5+
# Default settings:
6+
# A newline ending every file
7+
# Use 4 spaces as indentation
8+
[*]
9+
insert_final_newline = false
10+
indent_style = space
11+
indent_size = 4
12+
13+
# Code files
14+
[*.{cs,csx,vb,vbx}]
15+
indent_style = tab
16+
indent_size = 4
17+
18+
# Code files
19+
[*.sln]
20+
indent_size = 4
21+
22+
# Xml project files
23+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
24+
indent_size = 2
25+
26+
# Xml config files
27+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
28+
indent_size = 2
29+
30+
# JSON files
31+
[*.json]
32+
indent_size = 2
33+
34+
# XML files
35+
[*.xml]
36+
indent_size = 2
37+
38+
[*.cs]
39+
40+
# Organize usings
41+
dotnet_sort_system_directives_first = true
42+
43+
# IDE0160: Use file scoped namespace
44+
csharp_style_namespace_declarations = file_scoped:error
45+
46+
# CS4014: Because this call is not awaited, execution of the current method continues before the call is completed
47+
dotnet_diagnostic.CS4014.severity = error
48+
49+
# Remove explicit default access modifiers
50+
dotnet_style_require_accessibility_modifiers = omit_if_default:error
51+
52+
# CA1063: Implement IDisposable Correctly
53+
dotnet_diagnostic.CA1063.severity = error
54+
55+
# CA1001: Type owns disposable field(s) but is not disposable
56+
dotnet_diagnostic.CA1001.severity = error
57+
58+
# Pattern matching
59+
dotnet_style_object_initializer = true:suggestion
60+
dotnet_style_collection_initializer = true:suggestion
61+
dotnet_style_coalesce_expression = true:suggestion
62+
dotnet_style_null_propagation = true:suggestion
63+
dotnet_style_explicit_tuple_names = true:suggestion
64+
dotnet_style_prefer_is_null_check_over_reference_equality_method=true:suggestion
65+
66+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
67+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
68+
csharp_style_inlined_variable_declaration = true:suggestion
69+
csharp_style_throw_expression = true:suggestion
70+
csharp_style_conditional_delegate_call = true:suggestions
71+
72+
# Naming rules
73+
74+
dotnet_diagnostic.IDE1006.severity = error
75+
76+
## Public Fields are kept Pascal Case
77+
dotnet_naming_symbols.public_symbols.applicable_kinds = field
78+
dotnet_naming_symbols.public_symbols.applicable_accessibilities = public, internal
79+
80+
dotnet_naming_style.first_word_upper_case_style.capitalization = first_word_upper
81+
82+
dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols
83+
dotnet_naming_rule.public_members_must_be_capitalized.style = first_word_upper_case_style
84+
dotnet_naming_rule.public_members_must_be_capitalized.severity = suggestion
85+
86+
## Instance fields are camelCase
87+
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = error
88+
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
89+
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
90+
91+
dotnet_naming_symbols.instance_fields.applicable_kinds = field
92+
93+
dotnet_naming_style.instance_field_style.capitalization = camel_case
94+
dotnet_naming_style.instance_field_style.required_prefix = _
95+
96+
## Static fields are camelCase
97+
dotnet_naming_rule.static_fields_should_be_camel_case.severity = error
98+
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
99+
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
100+
101+
dotnet_naming_symbols.static_fields.applicable_kinds = field
102+
dotnet_naming_symbols.static_fields.required_modifiers = static
103+
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
104+
105+
dotnet_naming_style.static_field_style.capitalization = camel_case
106+
dotnet_naming_style.static_field_style.required_prefix = _
107+
108+
# Modifier preferences
109+
csharp_prefer_static_local_function = true:suggestion
110+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:error
111+
112+
# CA1822: Member does not access instance data and can be marked as static
113+
dotnet_diagnostic.CA1822.severity = suggestion
114+
115+
# CA1050: Declare types in namespaces
116+
dotnet_diagnostic.CA1050.severity = error
117+
118+
# CA2016: Forward the 'cancellationToken' parameter methods that take one
119+
dotnet_diagnostic.CA2016.severity = error
120+
121+
# CA2208: Method passes parameter as the paramName argument to a ArgumentNullException constructor. Replace this argument with one of the method's parameter names. Note that the provided parameter name should have the exact casing as declared on the method.
122+
dotnet_diagnostic.CA2208.severity = error
123+
124+
# CA1834: Use 'StringBuilder.Append(char)' instead of 'StringBuilder.Append(string)' when the input is a constant unit string
125+
dotnet_diagnostic.CA1834.severity = error
126+
127+
# IDE0220: Add explicit cast
128+
dotnet_diagnostic.IDE0220.severity = error

.github/workflows/build.yml

Lines changed: 101 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,110 @@ jobs:
1313
runs-on: macos-latest
1414

1515
steps:
16-
- uses: actions/checkout@v1
16+
- uses: actions/checkout@v1
1717

18-
- name: Setup .NET v6.0
19-
uses: actions/setup-dotnet@v1
20-
with:
21-
dotnet-version: '6.0.x'
18+
- name: Setup .NET v6.0
19+
uses: actions/setup-dotnet@v1
20+
with:
21+
dotnet-version: "6.0.x"
2222

23-
- name: Install Boots
24-
run : |
25-
dotnet tool install --global boots --prerelease
26-
boots --alpha Mono
27-
boots --alpha Xamarin.Android
28-
29-
- name: Print Build Info
30-
run : |
31-
msbuild --version
32-
dotnet --info
33-
- name: Build Android App
34-
run: |
35-
AndroidProject=`find . -name GitStatus.Android.csproj`
36-
echo $AndroidProject
23+
- name: Install .NET MAUI Workload
24+
run: |
25+
dotnet workload install maui
3726
38-
AndroidProjectDirectory=`dirname $AndroidProject`
39-
echo $AndroidProjectDirectory
40-
41-
msbuild $AndroidProjectDirectory /verbosity:normal /p:Configuration=Release /restore
27+
- name: Build Android App
28+
run: |
29+
MobileProject=`find . -name GitStatus.Mobile.csproj`
30+
echo $MobileProject
31+
32+
MobileProjectDirectory=`dirname $MobileProject`
33+
echo $MobileProjectDirectory
34+
35+
dotnet build $MobileProjectDirectory -f:net6.0-android -c Release
36+
37+
iOS:
38+
runs-on: macos-12
39+
40+
steps:
41+
- uses: actions/checkout@v1
42+
43+
- name: Setup .NET v6.0
44+
uses: actions/setup-dotnet@v1
45+
with:
46+
dotnet-version: "6.0.x"
47+
48+
- name: Install .NET MAUI Workload
49+
run: |
50+
dotnet workload install maui
51+
52+
- name: Install Xcode
53+
uses: maxim-lobanov/setup-xcode@v1
54+
with:
55+
xcode-version: latest
56+
57+
- name: Build iOS App
58+
run: |
59+
MobileProject=`find . -name GitStatus.Mobile.csproj`
60+
echo $MobileProject
61+
62+
MobileProjectDirectory=`dirname $MobileProject`
63+
echo $MobileProjectDirectory
64+
65+
dotnet build $MobileProjectDirectory -f:net6.0-ios -c Release
66+
67+
MacCatalyst:
68+
runs-on: macos-12
69+
70+
steps:
71+
- uses: actions/checkout@v1
72+
73+
- name: Setup .NET v6.0
74+
uses: actions/setup-dotnet@v1
75+
with:
76+
dotnet-version: "6.0.x"
77+
78+
- name: Install .NET MAUI Workload
79+
run: |
80+
dotnet workload install maui
81+
82+
- name: Install Xcode
83+
uses: maxim-lobanov/setup-xcode@v1
84+
with:
85+
xcode-version: latest
86+
87+
- name: Build macOS App
88+
run: |
89+
MobileProject=`find . -name GitStatus.Mobile.csproj`
90+
echo $MobileProject
91+
92+
MobileProjectDirectory=`dirname $MobileProject`
93+
echo $MobileProjectDirectory
94+
95+
dotnet build $MobileProjectDirectory -f:net6.0-maccatalyst -c Release
96+
97+
Windows:
98+
runs-on: windows-latest
99+
100+
steps:
101+
- uses: actions/checkout@v1
102+
103+
- uses: actions/setup-java@v2
104+
with:
105+
distribution: 'microsoft'
106+
java-version: '11'
107+
108+
- name: Setup .NET v6.0
109+
uses: actions/setup-dotnet@v1
110+
with:
111+
dotnet-version: "6.0.x"
112+
113+
- name: Install .NET MAUI Workload
114+
run: |
115+
dotnet workload install maui
116+
117+
- name: Build Windows App
118+
run: |
119+
dotnet build ./samples/GitStatus.Mobile/ -c Release
42120
43121
API:
44122
runs-on: macos-latest

Directory.Build.props

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
<WarningsAsErrors>nullable</WarningsAsErrors>
77
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
88
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
9+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
10+
<!--CS1570: XML comment has badly formed XML 'Expected an end tag for element [parameter] -->
11+
<!--CS1571: XML comment on [construct] has a duplicate param tag for [parameter] -->
12+
<!--CS1572: XML comment has a param tag for '[parameter]', but there is no parameter by that name -->
13+
<!--CS1573: Parameter has no matching param tag in the XML comment -->
14+
<!--CS1574: XML comment has cref attribute that could not be resolved-->
15+
<!--CS1734: XML comment has a paramref tag, but there is no parameter by that name-->
16+
<WarningsAsErrors>nullable,CS1570,CS1571,CS1572,CS1573,CS1574,CS1734</WarningsAsErrors>
917
</PropertyGroup>
1018
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
1119
<Optimize>true</Optimize>

0 commit comments

Comments
 (0)