microsoft / appcenter

Central repository for App Center open source resources and planning.
https://appcenter.ms
Creative Commons Attribution 4.0 International
1.01k stars 223 forks source link

.NET 6 #86

Open VladislavAntonyuk opened 5 years ago

VladislavAntonyuk commented 5 years ago

We have updated our project to .net 5 preview. But CI doesn't support it (.net core 3 is the latest). Please add support for .net 5

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further requests are made to keep it open.

wham commented 3 years ago

We are working on .NET 5.0 support. Should be available by the end of the year.

wham commented 3 years ago

We added .NET 5.0 this week. Please let us know if you notice any issues.

dersia commented 3 years ago

I just tried to run my pipeline again I am still getting an error CSC : error CS1617: Invalid option '9' for /langversion. I updated the Xamarin.iOS version to 14.6

wham commented 3 years ago

Thanks for reporting. We'll take another look.

dersia commented 3 years ago

This might help https://stackoverflow.com/questions/65309660/csc-on-macos-does-not-list-c-sharp-9

MasterEmit commented 3 years ago

I know this appcenter related and not azure devops, but I have the exact same problem with azure devops pipeline. Any idea how to solve that? Workaround?

Thanks and Greetz

AlenaSviridenko commented 3 years ago

Hi @MasterEmit, @dersia, could you please provide minimal steps to reproduce, so we can make sure the issue is related to the image and not to the project configuration? Also, it will help us to investigate the issue deeper. All our internal tests passed successfully for a variety of different projects.

Thank you.

DenLavrov commented 3 years ago

Same issue here. Any updates?

chrisstaley commented 3 years ago

I'm trying to compile a Xamarin Android app that references a .NET Standard library whose LangVersion is set to 9, and I'm getting the same error.

<PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
    <DebugType>portable</DebugType>
    <ProduceReferenceAssembly>true</ProduceReferenceAssembly>
    <Configurations>Debug;Test</Configurations>
    <LangVersion>9</LangVersion>
  </PropertyGroup>
AdamDiament commented 3 years ago

I have the same issue. My C Sharp 9 code has stopped compiling on app center android.

AlenaSviridenko commented 3 years ago

Hi folks, Could you please share some repro steps? It would really help us investigate this issue deeper, because all our internal tests are passed, and we are not getting a lot of feedbacks about broken .NET 5 (which can be expected if there were some obvious and easily reproducible issue)

Thanks!

chrisstaley commented 3 years ago

@AlenaSviridenko I included the elements in the csproj file that will cause the failure. So repro steps would be:

  1. Create .NET Standard assembly project with those elements.
  2. Create Android app.
  3. Make #2 reference #1.
  4. Build in AppCenter.
AdamDiament commented 3 years ago

@AlenaSviridenko Repro:

  1. Create a .net standard 2.0 assembly project, set <LangVersion>Latest</LangVersion> in the csproj file.
  2. Create Xamarin android project, referencing the project in step 1.
  3. In the step 1 project, add a class/file containing any C#9 syntax, for instance advanced pattern matching or the new switch statements with operators
  4. Build locally - it will build
  5. Push to app center, it will fail
dersia commented 3 years ago

Sorry it took me some time to come back to you.

Basically you just need a csproj file that has the following flag

<LangVersion>9</LangVersion>

I found a workaround for those who are still looking, but it only works with a custom build script (github action, azure pipelines)

Workaround

iOS

mono '/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/msbuild.dll' /p:Configuration=Release /p:Platform=iPhone <path/to/solutionfile.sln>

Android

mono '/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/msbuild.dll' /p:Configuration=Release /p:Platform=PackageForAndroid <path/to/android/project.csproj>

Why it works

using the MSBuild from the Path /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/ uses the MSBuild thats part of Visual Studio for Mac. VS4Mac has already c# 9 support, although mono does not. So this way you can compile C# 9 and .net5 code

Hope this helps

ahmedalejo commented 3 years ago

Hi folks, Could you please share some repro steps? It would really help us investigate this issue deeper, because all our internal tests are passed, and we are not getting a lot of feedbacks about broken .NET 5 (which can be expected if there were some obvious and easily reproducible issue)

Thanks!

I´m not sure where your metrics are coming from but you should have noticed that there is a spike in build failures due to C# 9.0 syntax issues.

##[error]Error: The process '/Library/Frameworks/Mono.framework/Versions/6_12_3/bin/msbuild' failed with exit code 1

I had the following in my Xamarin.Forms app

if (e.Source is ShellNavigationSource.Pop or ShellNavigationSource.PopToRoot  or ShellNavigationSource.Remove)
{...}

Visual Studio Mac which is installed on Mac Build Agents could/should be used for building the dlls. Or simply allowed as an alternative to using Mono directly.

AdamDiament commented 3 years ago

@dersia thanks for the workaround. What exactly do I do with your

mono '/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/msbuild.dll' /p:Configuration=Release /p:Platform=iPhone <path/to/solutionfile.sln>

Is this a build script I need to add in app center, or something in VS, or something else entirely?

dersia commented 3 years ago

@AdamDiament This is basically the Build-Step within your Build-Script. Unfortunately you can't run your own Build-Scripts directly in AppCenter at least as far as I know, so you will need another build-pipeline, that builds your app and then in another step pushes it to AppCenter. You can use either Github-Actions or Azure (DevOps) Pipelines.

If you need further help, please let me know.

varyamereon commented 3 years ago

@AdamDiament This is basically the Build-Step within your Build-Script. Unfortunately you can't run your own Build-Scripts directly in AppCenter at least as far as I know, so you will need another build-pipeline, that builds your app and then in another step pushes it to AppCenter. You can use either Github-Actions or Azure (DevOps) Pipelines.

If you need further help, please let me know.

@dersia If I am right then AppCenter does support build scripts. I have never used build scripts before, is it just a case of copying the line of code into an appcenter-pre-build.sh file? What would the path to solution file be then?

Thanks!

jvillaro commented 3 years ago

Hi guys, any updates?

Clement-Vivier commented 3 years ago

Sorry it took me some time to come back to you.

Basically you just need a csproj file that has the following flag

<LangVersion>9</LangVersion>

I found a workaround for those who are still looking, but it only works with a custom build script (github action, azure pipelines)

Workaround

iOS

mono '/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/msbuild.dll' /p:Configuration=Release /p:Platform=iPhone <path/to/solutionfile.sln>

Android

mono '/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/msbuild.dll' /p:Configuration=Release /p:Platform=PackageForAndroid <path/to/android/project.csproj>

Why it works

using the MSBuild from the Path /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/ uses the MSBuild thats part of Visual Studio for Mac. VS4Mac has already c# 9 support, although mono does not. So this way you can compile C# 9 and .net5 code

Hope this helps

Hello ! I struggle with your workaround, I'm basically trying to do the same, an azure pipeline who take a Xamarin forms 5.0 project in C#9 and every time I try to do the mono script that you give for android, I got an error, with

/Users/runner/.nuget/packages/xamarin.forms/5.0.0.2012/buildTransitive/Xamarin.Forms.targets(125,4): error MSB4064: The "ValidateOnly" parameter is not supported by the "XamlCTask" task. Verify the parameter exists on the task, and it is a settable public instance property. With a csproj given after that, i check in this csproj file, and I never use stuff like "ValidateOnly" after many times on Google someone has the same error within visual studio, but I find no one with this error on an azure pipeline. If you have any cloud, of what could be at the origin of this error. That will be a life safer to me.

Clément.

beeradmoore commented 3 years ago

@wham @nilofer 6 months since it was understood that this was going to be looked into. Is there any update on it?

@derana I appreciate the workaround. However, setting up a new CI/CD pipeline on an alternative service isn't a workaround as much as it is jumping ship.

EDIT: It appears nilofer is possibly no longer working on this project. Sorry for the tag.

jvillaro commented 3 years ago

Recently in one of the updates I saw that there was a way to eliminate the bar. Someone removed the default "Sign In" message and showed how to remove the bar via android manifest. It's not the ideal way but it worked. I need to try still on iOS

ederbond commented 3 years ago

@wham @davidortinau @maddyleger1 @hartez @StephaneDelcroix @jsuarezruiz do you have any news about when will be possible to build Xamarin Forms projects on AppCenter using the new C# 9 syntax on our code? currently delcaring field on any of my own call like below fails to build on AppCenter

MyClass _obj = new();

GLBekker commented 3 years ago

Good afternoon is anyone looking into this ? We are still having trouble building Lang 9 via App Center.

martin-slater commented 3 years ago

+1 for some movement on this. Has been nearly 2.5 years

AdamDiament commented 3 years ago

Still an issue for me. Bump. I'd like to be able to use C#10 soon too!

Safeer-Ahmad commented 3 years ago

Over 2 years and still no update on this. Any workaround??

ghost commented 3 years ago

See #2120 for workarounds to use C# 9 in AppCenter.

ghost commented 2 years ago

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

martin-slater commented 2 years ago

Bouncing this to keep it open. Come on, I pay for it, you update it!

AdamDiament commented 2 years ago

Bump!

marekdovjak commented 2 years ago

+1

santihcc commented 2 years ago

+1

santihcc commented 2 years ago

+1

FranRDev commented 2 years ago

+1

AnastasiaKubova commented 2 years ago

Hi there! Thanks for your interest in the feature! Please use reactions instead of +1.

nabeelio commented 2 years ago

Nevermind - wrong repo

RemcoDEV commented 2 years ago

When is App Center going to install .NET 6 SDKs to their build servers? Currently we can only choose between: 3.1.101 3.1.201 3.1.302 3.1.416 5.0.102 5.0.202 5.0.302 5.0.405

ericbrunner commented 2 years ago

still not on .NET 6

mphill commented 2 years ago

https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core

.NET 5 support ends May 8, 2022, and .NET 6 isn't supported yet...............

One of the issues is AppCenter processes the entire solution, so if you have an API in your project that targets .NET 6 your mobile apps will not build.

This is very problematic.

Mephisztoe commented 2 years ago

When trying to run a .NET 6 iOS app with AppCenter installed, I receive the following error message:

Exception_ios

Brosten commented 2 years ago

As for the workaround, after vs2022 was installed on MacOS images, msbuild can now be found here: /Applications/Visual\ Studio.app/Contents/MonoBundle/MSBuild/Current/bin/MSBuild.dll

softlion commented 2 years ago

The current nugets don't work with net6-ios (it works on net6-android).

Any clue ? I tried to start my app on an iOS simulator. It is a maui android+ios app, and i'm using VS Preview on windows.

The app build ok, it starts, but it crashes directly on an AppCenter call.

Any clue ?

System.TypeInitializationException: The type initializer for 'Microsoft.AppCenter.Utils.ApplicationLifecycleHelperDesktop' threw an exception.
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
   --- End of inner exception stack trace ---
   at Microsoft.AppCenter.ApplicationLifecycleHelper.get_Instance()
   at Microsoft.AppCenter.AppCenter..ctor()
   at Microsoft.AppCenter.AppCenter.get_Instance()
   at Microsoft.AppCenter.AppCenter.PlatformStart(String appSecret, Type[] services)
   at Microsoft.AppCenter.AppCenter.Start(String appSecret, Type[] services)
   ...
themronion commented 2 years ago

As for the workaround, after vs2022 was installed on MacOS images, msbuild can now be found here: /Applications/Visual\ Studio.app/Contents/MonoBundle/MSBuild/Current/bin/MSBuild.dll

So, we need to switch the default msbuild path to this one? Can u share how you can do it in a script for App Center?

ECDev01 commented 2 years ago

As for the workaround, after vs2022 was installed on MacOS images, msbuild can now be found here: /Applications/Visual\ Studio.app/Contents/MonoBundle/MSBuild/Current/bin/MSBuild.dll

So, we need to switch the default msbuild path to this one? Can u share how you can do it in a script for App Center?

Still no luck? any solution?

ECDev01 commented 2 years ago

As for the workaround, after vs2022 was installed on MacOS images, msbuild can now be found here: /Applications/Visual\ Studio.app/Contents/MonoBundle/MSBuild/Current/bin/MSBuild.dll

I have been talking to appcenter support team but not luck, their workaround keeps failing, I am not sure if they are really trying to help me or they are just wasting my time.

To change MSBuild path, Is it possible in AppCenter? If so, can you please show how? Thanks.

ericbrunner commented 2 years ago

@ECDev01 As you, I had no luck on that issue with appcenter support. Here are workarounds:

I ended up with building the app in Azure DevOps (CI) and uploaded the app with the appcenter deployment task (CD): https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/app-center-distribute

They can provide you a Pre-Build script to install .NET SDK of your choice:

https://docs.microsoft.com/en-us/appcenter/build/custom/scripts/#pre-build

I tried such one with .NET 6.0 but without success and because of lack of time, I took the other approach with deployment task.

Hope that helps :-)

themronion commented 2 years ago

For anyone still seeking how to support c#10 in App Center - u need to find an msbuild file in your system, copy it and change the second path there to the location of MSBuild.dll that is bundled with VS 2022. Then, in a post-clone script copy this file from your project's directory to the directory where you've found it on your system. Voila, there u have it. Welcome and enjoy

ECDev01 commented 2 years ago

@ECDev01 As you, I had no luck on that issue with appcenter support. Here are workarounds:

I ended up with building the app in Azure DevOps (CI) and uploaded the app with the appcenter deployment task (CD): https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/app-center-distribute

They can provide you a Pre-Build script to install .NET SDK of your choice:

https://docs.microsoft.com/en-us/appcenter/build/custom/scripts/#pre-build

I tried such one with .NET 6.0 but without success and because of lack of time, I took the other approach with deployment task.

Hope that helps :-)

Thanks mate, I am so close to do this but first I will try @themronion otherwise good bye AppCenter!