1、在系统的中断命令行中输入如下命令,安装.NET 8环境。
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install -y dotnet-sdk-8.0
2、在终端命令行中使用dotnet --version 查看安装的.NET 版本。如下图。
3、下载安装Rider,现在针对个人免费喽。下载后解压在bin目录下双击 rider.sh 可执行程序,运行rider。
4、安装Uno Platform 。
dotnet tool install -g uno.check
dotnet tool update -g uno.check
uno-check
5、在Rider中添加Uno Platform的项目模版。在欢迎页面选择左下角的设置->插件->搜索Uno Platform->安装->重启IDE,重启IDE后再新建解决方案中就可以找到Uno Platform的项目模版了。
6、创建项目后运行效果如下图。
7、上文中没有关于android环境的配置,接下来补全。如果选择了包括android和ios等系统,会发现如下错误提示。
2>UnoAppPrism.csproj: Error NU1012 : Platform version is not present for one or more target frameworks, even though they have specified a platform: net8.0-android, net8.0-ios, net8.0-maccatalyst
2>UnoAppPrism.csproj: Error NU1012 : Platform version is not present for one or more target frameworks, even though they have specified a platform: net8.0-android, net8.0-ios, net8.0-maccatalyst
2>Uno.Build.targets(124,4): Error UNOB0014 : Building for Windows is not supported on non-Windows systems. See for more details: https://aka.platform.uno/UNOB0014
2>Uno.Build.targets(132,4): Error UNOB0014 : Building for Apple platforms is not supported on Linux. See for more details: https://aka.platform.uno/UNOB0014
2>Uno.Build.targets(132,4): Error UNOB0014 : Building for Apple platforms is not supported on Linux. See for more details: https://aka.platform.uno/UNOB0014
2>Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): Error NETSDK1147 : 要构建此项目,必须安装以下工作负载: android
要安装这些工作负载,请运行以下命令: dotnet workload restore
2>------- Finished building project: UnoAppPrism. Succeeded: False. Errors: 6. Warnings: 0
以android为例,可以执行下面的命令安装android
sudo dotnet workload install android
安装android后,如下图。
1>------- Started building project: UnoAppPrism
1>UnoAppPrism.csproj: Error NU1012 : Platform version is not present for one or more target frameworks, even though they have specified a platform: net8.0-ios, net8.0-maccatalyst
1>UnoAppPrism.csproj: Error NU1012 : Platform version is not present for one or more target frameworks, even though they have specified a platform: net8.0-ios, net8.0-maccatalyst
1>UnoAppPrism.csproj: Error NU1012 : Platform version is not present for one or more target frameworks, even though they have specified a platform: net8.0-ios, net8.0-maccatalyst
1>Uno.Build.targets(124,4): Error UNOB0014 : Building for Windows is not supported on non-Windows systems. See for more details: https://aka.platform.uno/UNOB0014
1>Uno.Build.targets(132,4): Error UNOB0014 : Building for Apple platforms is not supported on Linux. See for more details: https://aka.platform.uno/UNOB0014
1>Uno.Build.targets(132,4): Error UNOB0014 : Building for Apple platforms is not supported on Linux. See for more details: https://aka.platform.uno/UNOB0014
1>------- Finished building project: UnoAppPrism. Succeeded: False. Errors: 6. Warnings: 0
哪是不是ios就是?
sudo dotnet workload install ios
1>------- Started building project: UnoAppPrism
1>UnoAppPrism.csproj: Error NU1012 : Platform version is not present for one or more target frameworks, even though they have specified a platform: net8.0-ios, net8.0-maccatalyst
1>UnoAppPrism.csproj: Error NU1012 : Platform version is not present for one or more target frameworks, even though they have specified a platform: net8.0-ios, net8.0-maccatalyst
1>UnoAppPrism.csproj: Error NU1012 : Platform version is not present for one or more target frameworks, even though they have specified a platform: net8.0-ios, net8.0-maccatalyst
1>Uno.Build.targets(124,4): Error UNOB0014 : Building for Windows is not supported on non-Windows systems. See for more details: https://aka.platform.uno/UNOB0014
1>Uno.Build.targets(132,4): Error UNOB0014 : Building for Apple platforms is not supported on Linux. See for more details: https://aka.platform.uno/UNOB0014
1>Uno.Build.targets(132,4): Error UNOB0014 : Building for Apple platforms is not supported on Linux. See for more details: https://aka.platform.uno/UNOB0014
1>------- Finished building project: UnoAppPrism. Succeeded: False. Errors: 6. Warnings: 0
说说感受吧,不能在Linux上编译Window、也不能搞ios,真是一万个神兽。不知道是不是我的问题,请懂的兄弟赐教。非常感谢