The Windows agents on App Center seem to have VS 2019 16.6 on them. Source Generators and other C# 9 features require VS 2019 16.8 and later. Similarly, .NET 5 requires 16.8 or later to build with VS.
Customers are impacted - as the author of a source generator, a customer reported builds failing when attempting to use it:
https://github.com/reactiveui/refit/issues/1074
Btw, App Center uses MacOS agents for Xamarin builds
https://docs.microsoft.com/en-us/appcenter/build/software
Either way, it needs the latest Mono that has MSBuild 16.8 or later.
On App Center we use mono to build the projects. We can't use msbuild from VS4M on our pipelines
Whatever support of C# features it provides in the latest stable version we provide to the customers. https://www.mono-project.com/docs/about-mono/compatibility/
As soon mono will support the c# 9 feature it will be available for our customers.
Mono does support c# 9 because I able to build on my PC Xamarin project which consumes c# 9
@Alex-Dobrynin
The official installation of mono
mono --version
Mono JIT compiler version 6.12.0.122 (tarball Mon Feb 22 17:33:28 UTC 2021)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(610)
Suspend: hybrid
GC: sgen (concurrent by default)
and now to msbuild version coming with the latest mono
msbuild -version
Microsoft (R) Build Engine version 16.6.0 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
16.6.0.15201
Mono does support c# 9 because I able to build on my PC Xamarin project which consumes c# 9
I guess you are referring to the msbuild version coming along with the Visual Studio for Mac which we are not using on our build agents.
So, I suppose your build agents should use latest msbuild, to be able to make xamarin builds, because our company paying money for appcenter usage and thus wants to have always up-to-date environment. In our project c# 9 is used and many nugets which use .net5. You should update your environment when these technologies are under preview, so you can release in time and don`t let your customers wait, because they wasting their money and time
Thank you for your feedback and suggestion.
To use the latest msbuild which is not part of mono will require a huge redesign of the build pipelines.
Currently App Center is in the maintenance mode and we have no capacity to take this feature request.
@andrii-z4i What do you mean by this?
We can't use msbuild from VS4M on our pipelines
App Center runs on top of Azure Dev Ops, which _can_ use the MsBuild that comes packaged with VS for Mac.
In fact, we use the version of MsBuild that is packaged with VS for Mac for our XamarinCommunityToolkit library builds.
Here's the code from our Azure Dev Ops Pipeline YAML file that demonstrates how we're doing it:
https://github.com/xamarin/XamarinCommunityToolkit/blob/98aa44b2f6fe9cbfbd3f7f9a8a90a94d609dfb5b/azure-pipelines.yml#L193-L196
To use the latest msbuild which is not part of mono will require a huge redesign of the build pipelines.
I imagine it would just require an environment variable / symbolic link change for msbuild. For example, point msbuild to /Applications/Visual\ studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/MSBuild.dll instead of using the current default msbuild.
I'm happy to jump on a call with you to discuss this.
will require a huge redesign of the build pipelines.
It shouldn't be our headache.
and we have no capacity to take this feature request.
Then find, because customer who paying money doesn't care about such cases.
It's the same, when my customer finds bug in production and I tell him that I cannot fix it. Then he will find a developer who will fix it. And this means - I will not have money any more from this customer
I am having the exact same issue. Is there a workaround to use latest MSBuild in AppCenter?
Same here - migrated everything to Refit 6 today - just to see now the builds fail on AppCenter...? :(
Similar issue:
OMG cannot believe this is still a thing.
Why isn't there a hint in AppCenter somewhere that warns us about the latest supported C# lang?
I image it would just require an environment variable / symbolic link change for msbuild. For example, point msbuild to /Applications/Visual studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/MSBuild.dll instead of using the current default msbuild.
@brminnick this seems like a pretty big oversight on the part of the Mono/VS4Mac team... seems to me that they should not be shipping multiple versions of MSBuild and should be ensuring that the version called from the cli is the latest build.
FYI - Mono 6.12.0.137 was updated recently to include MSBuild 16.9.
Still not working for me. Anyone else?
My agent is still using MSBuild 16.6.0
Yes, I still have this issue with my YAML. Why is this closed?
I still have this issue with records and new operator (C# version 9 - https://github.com/microsoft/appcenter/issues/2136)
This issue IMHO should not be marked as closed. It's very much alive in the real world, affecting customers just like me! With the greatest respect to @andrii-z4i if AppCenter is in maintenance mode, it still needs to move with production changes to critical dependencies, such as C# releases and MSBuild. If AppCenter.ms won't support me building my products when I'm using production-ready IDE, languages, packages... I simply can't use it anymore 馃槥
still having this issue as well, should not be closed
Built today and have the same issue. Why is the issue still closed?
Today I had the same problem, is there any solution for that?
I was having the same issue and I solved it by changing my Mono download URL to the following:
https://download.mono-project.com/archive/6.12.0/macos-10-universal/MonoFramework-MDK-6.12.0.137.macos10.xamarin.universal.pkg
I was having the same issue and I solved it by changing my Mono download URL to the following:
https://download.mono-project.com/archive/6.12.0/macos-10-universal/MonoFramework-MDK-6.12.0.137.macos10.xamarin.universal.pkg
That's great! How...?
I was having the same issue and I solved it by changing my Mono download URL to the following:
https://download.mono-project.com/archive/6.12.0/macos-10-universal/MonoFramework-MDK-6.12.0.137.macos10.xamarin.universal.pkg
I've added in my appcenter-post-clone.sh:
# Download Mono 6.12.0.137
wget https://download.mono-project.com/archive/6.12.0/macos-10-universal/MonoFramework-MDK-6.12.0.137.macos10.xamarin.universal.pkg
# Add execution permission
sudo chmod +x MonoFramework-MDK-6.12.0.137.macos10.xamarin.universal.pkg
# Install Mono 6.12.0.137sudo installer -pkg MonoFramework-MDK-6.12.0.137.macos10.xamarin.universal.pkg -target /
But it's saying
##[section]Starting: Restore Nuget
==============================================================================
Task : Command Line
Description : Run a command line with arguments
Version : 1.1.3
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
==============================================================================
[command]/bin/bash -c /usr/bin/find . -name '*.sln' -type f -print0 | /usr/bin/xargs -0 grep -l 'xxxClient.Droid.csproj' | /usr/bin/xargs -I '{}' nuget restore '{}' -DisableParallelProcessing
(node:2623) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2623) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2623) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2623) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2623) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2623) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2623) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2623) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2623) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2623) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2623) Warning: Use Cipheriv for counter mode of aes-256-ctr
xargs: nuget: No such file or directory
##[error]/bin/bash failed with return code: 127
##[error]/bin/bash failed with error: /bin/bash failed with return code: 127
##[section]Finishing: Restore Nuget
What's is wrong with this?
Can you share some more details with us @Osmosis311 ? Maybe your script you used to install the 6.12 version?
Thanks in advance!
Ok, so AppCenter is making me cranky... so, to get an actual working build I switched to Azure DevOps (if you want something done right...etc.)
Anyway...
The "magic, secret sauce" is obviously to install the newest version of stuff, before trying to do the NuGet restore, so something like this worked for me in my YAML:
steps:
# Install the newest .Net Core
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '3.1.x'
includePreviewVersions: true
# Install Newest Mono
- task: Boots@1
inputs:
uri: 'https://download.mono-project.com/archive/6.12.0/macos-10-universal/MonoFramework-MDK-6.12.0.137.macos10.xamarin.universal.pkg'
# Install Newest Xamarin
- task: Boots@1
inputs:
uri: 'https://aka.ms/xamarin-android-commercial-d16-9-macos'
- task: NuGetToolInstaller@1
inputs:
versionSpec:
checkLatest: true
- task: NuGetCommand@2
inputs:
restoreSolution: '**/*.sln'
Yes, I am allowing preview versions... because I am an unreasonable, bad man. Tough, idc.
I suspect @Krusty93 is pretty close to a solution with that script code and the only issue I immediately see (which I am not sure if it is a post formatting / copy-paste error) is that the command:
sudo installer -pkg MonoFramework-MDK-6.12.0.137.macos10.xamarin.universal.pkg -target /
is marked as a comment.... also not sure that setting the target path of "/" is the right thing to do here (installing to root seems... excessive), but I honestly don't know.
Just wanted to confirm that downloading the mono pkg and getting it installed fixed the issue for me. However the release readme displayed in the installer lists MSBuild as 15, which is wrong.
Just wanted to confirm that downloading the mono pkg and getting it installed fixed the issue for me. However the release readme displayed in the installer lists MSBuild as 15, which is wrong.
@ArtS How can I download mono pkg in app center. Should i use some script?
@Alex-Dobrynin apologies no idea re app centre. I was having issues with a bunch of projects not loading locally on MacOS in JetBrains Rider.
@andrii-z4i What do you mean by this?
We can't use msbuild from VS4M on our pipelines
App Center runs on top of Azure Dev Ops, which _can_ use the MsBuild that comes packaged with VS for Mac.
In fact, we use the version of MsBuild that is packaged with VS for Mac for our XamarinCommunityToolkit library builds.
Here's the code from our Azure Dev Ops Pipeline YAML file that demonstrates how we're doing it:
https://github.com/xamarin/XamarinCommunityToolkit/blob/98aa44b2f6fe9cbfbd3f7f9a8a90a94d609dfb5b/azure-pipelines.yml#L193-L196To use the latest msbuild which is not part of mono will require a huge redesign of the build pipelines.
I image it would just require an environment variable / symbolic link change for
msbuild. For example, pointmsbuildto/Applications/Visual\ studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/MSBuild.dllinstead of using the current defaultmsbuild.I'm happy to jump on a call with you to discuss this.
Hello Brandon,
do you mind explaining this further?
I tried to resolve a similar issue with refit and AppCenter but to no avail.
I would like to know, if this issue will be fixed. My company is paying for the build hours and I can't use it. I will cancel my plan if I can't use the build feature. I'm willing to wait until this is fixed, but not forever...
The App Center team has been clear that they are not going to fix this Issue, and I can confirm that the same problem still exists today in App Center Build.
My recommendation is to move your Continuous Integration Builds to GitHub Actions.
Here is the GitHub Action that I use for my CI Builds for my App Store app, GitTrends:
https://github.com/brminnick/GitTrends/blob/main/.github/workflows/mobile.yml
Thanks for your hint, brminnick. sure will take a look at it. appcenter was really very easy to set up, but without the ability to build, I cancelled my plan now.
You shouldn't need any work arounds... the latest stable release of Mono (6.12.0.140) which should either be available on App Center or should be be available soon ships with the newer version of MSBuild that is required for Source Generators
While this hopefully will be resolved properly soon here is the workaround we're using in our Azure DevOps Pipeline to build a Xamarin.Forms App (with the Xamarin.iOS task) using the installed VS4M MSbuild Version (16.10 last I checked)
#! /bin/bash
mono "/Applications/Visual studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/MSBuild.dll" "$@"
- name: msbuildproxy
value: $(Pipeline.Workspace)/s/your/path/to/scriptname.sh
- task: CmdLine@2
inputs:
script: 'chmod u+x $(msbuildproxy)'
- task: XamariniOS@2
inputs:
solutionFile: '**/*.sln'
configuration: 'Release'
packageApp: true
runNugetRestore: false
mdtoolFile: '$(msbuildproxy)'
@brminnick after doing this workaround appcenter successfully built android but I cannot install this apk. and iOS build failed because of this issue: error NETSDK1005: Assets file '/Users/runner/work/1/s///obj/project.assets.json' doesn't have a target for 'netstandard2.1'. Ensure that restore has run and that you have included 'netstandard2.1'
but in my cproj file i have next:
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
any thoughts what I can do?
@Alex-Dobrynin I am having the exact same issue, did you find a resolution?
@mwerickson I was able to resolve that issue by using a newer version of nuget.
Add the following to your appcenter-pre-build.sh
wget https://dist.nuget.org/win-x86-commandline/v5.10.0/nuget.exe
ln -s /Library/Frameworks/Mono.framework/Versions/Current/Commands/nuget nuget
Hello - I've tried the following appcenter-post-clone.sh
#!/usr/bin/env bash
# Download Mono 6.12.0.145
wget https://download.mono-project.com/archive/6.12.0/macos-10-universal/MonoFramework-MDK-6.12.0.145.macos10.xamarin.universal.pkg
# Add execution permission
sudo chmod +x MonoFramework-MDK-6.12.0.145.macos10.xamarin.universal.pkg
# Install Mono 6.12.0.145
sudo installer -pkg MonoFramework-MDK-6.12.0.145.macos10.xamarin.universal.pkg -target /
I'm receiving the following error in appcenter:
[command]/bin/bash -c /usr/bin/find . -name '*.sln' -type f -print0 | /usr/bin/xargs -0 grep -l 'Cellar.iOS.csproj' | /usr/bin/xargs -I '{}' nuget restore '{}' -DisableParallelProcessing
(node:1747) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:1747) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:1747) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:1747) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:1747) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:1747) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:1747) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:1747) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:1747) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:1747) Warning: Use Cipheriv for counter mode of aes-256-ctr
xargs: nuget: No such file or directory
##[error]/bin/bash failed with return code: 127
##[error]/bin/bash failed with error: /bin/bash failed with return code: 127
##[section]Finishing: Restore Nuget
##[section]Starting: Checkout Cellar@master to s
@mwerickson I was able to resolve that issue by using a newer version of nuget.
Add the following to your appcenter-pre-build.sh
wget https://dist.nuget.org/win-x86-commandline/v5.10.0/nuget.exe ln -s /Library/Frameworks/Mono.framework/Versions/Current/Commands/nuget nuget
This didn't work for me. Does it matter where in the script it is added?
I tried at both the start and end of the appcenter-pre-build.sh script with no luck.
Still getting the follow error
obj/project.assets.json' doesn't have a target for 'netstandard2.1'. Ensure that restore has run and that you have included 'netstandard2.1' in the TargetFrameworks for your project.
@mwerickson & @Alex-Dobrynin Did you manage to resolve the issue. If so, how?
I now have this working. At the end of my script I added the following
echo "MSBuild restore start"
MSBuild /Users/runner/work/1/s/[**YOUR PROJECT NAME**]/[**YOUR PROJECT NAME**].iOS/[**YOUR PROJECT NAME**].iOS.csproj -t:restore
echo "MSBuild restore finish"
for example
echo "MSBuild restore start"
MSBuild /Users/runner/work/1/s/MyApp/MyApp.iOS/MyApp.iOS.csproj -t:restore
echo "MSBuild restore finish"
Thanks all I finally got this working with appcenter-pre-build.sh
Below is my full file:
wget https://dist.nuget.org/win-x86-commandline/v5.10.0/nuget.exe
ln -s /Library/Frameworks/Mono.framework/Versions/Current/Commands/nuget nuget
#!/usr/bin/env bash
# Download Mono 6.12.0.145
wget https://download.mono-project.com/archive/6.12.0/macos-10-universal/MonoFramework-MDK-6.12.0.145.macos10.xamarin.universal.pkg
# Add execution permission
sudo chmod +x MonoFramework-MDK-6.12.0.145.macos10.xamarin.universal.pkg
# Install Mono 6.12.0.145
sudo installer -pkg MonoFramework-MDK-6.12.0.145.macos10.xamarin.universal.pkg -target /
echo "MSBuild restore start"
MSBuild /Users/runner/work/1/s/FormsApp/FormsApp.iOS/FormsApp.iOS.csproj -t:restore
echo "MSBuild restore finish"
Currently App Center is in the maintenance mode and we have no capacity to take this feature request.
is that to say that App Center is being replaced by something else? if so I'd like to know as my company is paying for build hours and if there's a new and better platform I'd much prefer they pay for that than something that's broken (and never planned to be fixed) and prevents me from getting a test app out to QA.
Most helpful comment
Same here - migrated everything to Refit 6 today - just to see now the builds fail on AppCenter...? :(