2 Star 1 Fork 0

痕迹 / maui-samples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

.NET 6.0.0 Mobile Samples

This is an early preview of Mobile (iOS/Android) in .NET 6 not for production use. Expect breaking changes as this is still in development for .NET 6.

This repo requires a specific build of .NET 6:

You will also need to install builds of the iOS and Android workloads:

Android:

iOS:

NOTE: newer builds of .NET may work, but your mileage may vary. The workload installers enable a feature flag file via sdk/6.0.100-preview.1.21103.13/EnableWorkloadResolver.sentinel, which would need to be created manually for other .NET 6 versions. You can find the full list of builds at the dotnet/installer repo.

Projects:

  • HelloAndroid - a native Android application
  • HelloiOS - a native iOS application
  • HelloForms - a multi-targeted Xamarin.Forms application for iOS and Android (will migrate to MAUI in a later preview)

Android

Prerequisites:

  • You will need the Android SDK installed as well as Android SDK Platform 30. Simplest way to get this is to install the current Xamarin workload and go to Tools > Android > Android SDK Manager from within Visual Studio.

For example, to build the Android project:

dotnet build HelloAndroid

You can launch the Android project to an attached emulator or device via:

dotnet build HelloAndroid -t:Run

iOS

Prerequisites:

  • Xcode 12.3. Earlier versions won't work.

To build the iOS project:

dotnet build HelloiOS

To launch the iOS project on a simulator:

dotnet build HelloiOS -t:Run

Xamarin.Forms / MAUI

In later previews, this sample will be migrated to use MAUI

To launch the Forms project, you will need to specify a $(TargetFramework) via the -f switch:

dotnet build HelloForms -t:Run -f net6.0-android
dotnet build HelloForms -t:Run -f net6.0-ios

NOTE: You may need to add the --no-restore switch until dotnet#15485 is resolved.

Using IDEs

Currently, you can use Visual Studio 2019 16.9 Preview 4 on Windows (with the Xamarin workload) with a few manual steps.

Open an Administrator command prompt to enable the EnableWorkloadResolver.sentinel feature flag:

> cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver"
> echo > EnableWorkloadResolver.sentinel

NOTE: your path to Visual Studio may vary, depending on where you selected to install it. Preview is the default folder for Visual Studio Preview versions.

Restart Visual Studio after making this change.

Workarounds

These are notes for things we had to workaround for these samples to work.

NuGet

Currently, NuGet is not able to restore existing Xamarin.Android/iOS packages for a .NET 6 project. We tried $(AssetTargetFallback), however, this option does not work in combination with transitive dependencies. The Xamarin.AndroidX.* set of NuGet packages has a complex dependency tree.

Additionally, we had some problems with the Xamarin.Forms NuGet package listing the same assembly in both:

  • lib\netstandard2.0\Xamarin.Forms.Platform.dll
  • lib\MonoAndroid10.0\Xamarin.Forms.Platform.dll

For now we added workarounds in xamarin-android, see xamarin-android#4663.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

MIT License Copyright (c) Microsoft Corporation. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

简介

暂无描述 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/henjiggg/maui-samples.git
git@gitee.com:henjiggg/maui-samples.git
henjiggg
maui-samples
maui-samples
6.0.1xx-preview1

搜索帮助