gpt4 book ai didi

xamarin - 有没有人用 gitlab-ci 成功构建 Xamarin.Forms?

转载 作者:行者123 更新时间:2023-12-04 02:29:06 25 4
gpt4 key购买 nike

我正在使用 Xamarin.Forms 开发一个宠物项目,想知道是否有人有成功配置 gitlab-ci.yml 构建的经验。一般而言,关于 .NET 构建配置的 Material 似乎有限,在将两个构建连接在一起之前尝试成功构建一个的运气。已尝试将每个项目 .csproj 用于构建路径。

任何见解和经验将不胜感激。

当前 .gitlab-ci.yml

image: mono

variables:
Solution: Solution.sln

stages:
- build
- test
- deploy

before_script:
- nuget restore $Solution

build:
stage: build
script:
- MONO_IOMAP=case xbuild /p:Configuration="Release" /p:Platform="iPhone" /t:Build $Solution

最佳答案

是的,我们让它在不需要使用引导或 AzureDevops 的情况下完美运行。正如@AkashKava 提到的,我不得不让它在 Mac 构建代理/运行器上运行,我使用了 AppCenter's CLI commands对于它的分发部分,我还存储了我的证书、 keystore 和配置文件。
因此,在一切运行之前,请确保您恢复了 nuget 包并安装了必要的库 nuget , msbuild , appcenter ,...:

before_script:
- nuget restore
然后,创建一个 Android QA apk 文件:
android_dev_apk:
stage: build
dependencies: []
tags:
- xamarin
script:
- msbuild {AppName}.sln $BUILD_VERBOSITY /t:Clean /p:Configuration=Dev
- msbuild {AppName}.sln $BUILD_VERBOSITY /t:Build /p:Configuration=Dev
- msbuild {AppName}.Android/{AppName}.Android.csproj $BUILD_VERBOSITY /t:PackageForAndroid /t:SignAndroidPackage /p:Configuration=Dev /p:AndroidKeyStore=True
只需将 {AppName} 替换为您的应用程序的文件夹名称/应用程序名称,这与我的情况相同。类似的对于iOS
ios_qa_app:
stage: build
dependencies: []
tags:
- xamarin
script:
- rm -rf {AppName}.iOS/bin/iPhone/QA
- msbuild {AppName}.sln $BUILD_VERBOSITY /t:Clean /p:Platform=iPhone /p:Configuration=QA
- msbuild {AppName}.sln $BUILD_VERBOSITY /t:Build /p:Platform=iPhone /p:ArchiveOnBuild=true /p:Configuration=QA
artifacts:
paths:
- {AppName}.iOS/bin/iPhone/QA/{AppName}.ipa
- {AppName}.iOS/bin/iPhone/QA/{AppName}.app.dSYM
expire_in: 10 day
when: on_success
only:
- schedules
except:
variables:
- $ProdBuild == "true"

注意下 script , 一切都像使用终端时一样,所以你也可以输入诸如 ls 之类的东西。只是为了在输出日志中打印该文件夹中的文件列表,或者 cd ..cd DirectoryName更改文件夹。
因此,要分发 Android 工件,请将其添加到您的 Android 脚本中:
    - appcenter distribute release --app {CompanyInAppCenter}/{AndroidAppNameInAppCenter} --group "Collaborators" --file {AppName}.Android/bin/QA/{BundleIdentifier}-Signed.apk --token=${APPCENTER_API_TOKEN}
最后,要分发 iOS 工件,请将其添加到您的 iOS 脚本中:
    - appcenter distribute release --app {CompanyInAppCenter}/{iOSAppNameInAppCenter} --group "Collaborators" --file {AppName}.iOS/bin/iPhone/QA/{AppName}.ipa --token=${APPCENTER_API_TOKEN}
PS:我写了一篇关于如何做这些东西的文章 using GitHub Actions不使用您自己的构建代理。

关于xamarin - 有没有人用 gitlab-ci 成功构建 Xamarin.Forms?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42757115/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com