Xamarin Forms Project AppCenter Build Fails

LukeTimLukeTim Member ✭✭
edited November 2018 in Xamarin.Forms

I have a Xamarin Forms project for an iOS App which is failing to build on App Center. I don't have any issues building locally in Visual Studio, nor even with running the app on my own iPhone. It has in fact never succeeded in building on App Center. The error seems to be with an open source project which I included the source code for, and have made some changes to.

I have looked over the dependencies for the project and made sure my entire codebase is checked into my git repo, but I can't figure out what's going wrong. This is my first Xamarin Project, so I'd appreciate some help/guidance with figuring out what's wrong if possible. I've attached a text file containing the build output.

Thanks.

Best Answer

  • LukeTimLukeTim ✭✭
    edited November 2018 Accepted Answer

    I have managed to resolve the problem. There was a duplication in the csproj file for the SwipeCards project. I found both <TargetFrameworks> and <TargetFramework> tags. I removed the <TargetFrameworks> and the build now succeeds.

Answers

  • JohnHJohnH GBMember ✭✭✭✭✭

    @LukeTim said:
    I have a Xamarin Forms project for an iOS App which is failing to build on App Center. I don't have any issues building locally in Visual Studio, nor even with running the app on my own iPhone. It has in fact never succeeded in building on App Center. The error seems to be with an open source project which I included the source code for, and have made some changes to.

    I have looked over the dependencies for the project and made sure my entire codebase is checked into my git repo, but I can't figure out what's going wrong. This is my first Xamarin Project, so I'd appreciate some help/guidance with figuring out what's wrong if possible. I've attached a text file containing the build output.

    Thanks.

    I googled the error I spotted in your log (error CS0103: The name 'InitializeComponent' does not exist in the current context) and found https://forums.xamarin.com/discussion/62671/initializecomponent-does-not-exist-in-the-current-context-error, maybe it will have something useful for you?

    I know you have already checked the repo is up to date, but can you try cloning the repo to a new location and build that locally. That will ensure you are definitely building the same code as AppCenter.
    Also, do you have any private nuget packages? You will need to make AppCenter aware of where they are as they wont be on nuget.org.

    Cheers
    John

  • LukeTimLukeTim Member ✭✭

    @JohnHair said:

    @LukeTim said:
    I have a Xamarin Forms project for an iOS App which is failing to build on App Center. I don't have any issues building locally in Visual Studio, nor even with running the app on my own iPhone. It has in fact never succeeded in building on App Center. The error seems to be with an open source project which I included the source code for, and have made some changes to.

    I have looked over the dependencies for the project and made sure my entire codebase is checked into my git repo, but I can't figure out what's going wrong. This is my first Xamarin Project, so I'd appreciate some help/guidance with figuring out what's wrong if possible. I've attached a text file containing the build output.

    Thanks.

    I googled the error I spotted in your log (error CS0103: The name 'InitializeComponent' does not exist in the current context) and found https://forums.xamarin.com/discussion/62671/initializecomponent-does-not-exist-in-the-current-context-error, maybe it will have something useful for you?

    I know you have already checked the repo is up to date, but can you try cloning the repo to a new location and build that locally. That will ensure you are definitely building the same code as AppCenter.
    Also, do you have any private nuget packages? You will need to make AppCenter aware of where they are as they wont be on nuget.org.

    Cheers
    John

    Hi John,

    Thanks for your response. Unfortunately, it looks like The InitializeComponent error can be a result of different things, and the link you provided doesn't seem to be helpful.

    I have cloned the repo locally and built in Visual Studio without any issues. I also don't have any private nuget packages. Apart from Xamarin packages the only ones I am using are SQLite-Net and SQLite Extensions.

  • LukeTimLukeTim Member ✭✭
    edited November 2018

    Looking at the following snippet from the build log, it looks like there is an issue with the Target Frameworks from the csproj file for the Open Source SwipeCards project I have included...

    "/Users/vsts/agent/2.142.1/work/1/s/TodoQ.sln" (Rebuild target) (1) ->
    "/Users/vsts/agent/2.142.1/work/1/s/TodoQ.iOS/TodoQ.iOS.csproj" (Rebuild target) (2) ->
    "/Users/vsts/agent/2.142.1/work/1/s/TodoQ/TodoQ.csproj" (default target) (3:3) ->
    "/Users/vsts/agent/2.142.1/work/1/s/SwipeCards.Controls/SwipeCards.Controls.csproj" (default target) (4:3) ->
    (CoreCompile target) ->
    Views/CardView.xaml.cs(16,13): error CS0103: The name 'InitializeComponent' does not exist in the current context [/Users/vsts/agent/2.142.1/work/1/s/SwipeCards.Controls/SwipeCards.Controls.csproj]

    I am unsure what the problem is here... I don't understand the build process well enough to know what problem the targets could cause... I've attached the csproj file in case anybody can take a look and give me a hand...

  • LukeTimLukeTim Member ✭✭
    edited November 2018 Accepted Answer

    I have managed to resolve the problem. There was a duplication in the csproj file for the SwipeCards project. I found both <TargetFrameworks> and <TargetFramework> tags. I removed the <TargetFrameworks> and the build now succeeds.

Sign In or Register to comment.