1

I wanted to start implementing a mobile cross-plattform application which should call an existing WCF-Service with XamarinForms. I'm pretty new to the whole Xamarin thing, so maybe its a pretty easy solution.

So what I did was creating a new Xamarin.Forms Portable Project which includes all the Droid, iOS project and stuff. In the library project I added a new Content-Page, wrote some dummy "hello world" code and startet, works just like a charm.

enter image description here

The problem comes when I want to add an existing library that I've used in a WPF application that also connects to the said WCF service. In there I've implemented a service proxy class that I wanted to reuse in my xamarin application.

After I add the Library, Visual Studio just seems to go crazy and tells me that the InitializeComponents Method and all the labels and stuff I defined in my xaml couldn't be found. After deleting the library from the references again, the errors just stay the same. Strange thing is that I can run the app anyways.

From the project settings it says that the xamarin app is going to build with .NET 4.5, so I recompiled my library also to 4.5, but doesn't seem to do the trick. Is it because I use some classes in my library that are not supported (e.g. System.ServiceModel?)

Maybe someone a bit more about this behaviour, and can give me a hint!

Thanks for the help!

Cheers

Michael Faisst
  • 587
  • 7
  • 20

1 Answers1

2

This happened to me as well. The symptoms are exactly the same; xaml.cs file is showing error in the editor, while the project itself compiles and runs just fine. But in my case, I didn't notice any particular trigger. I mean, in it isn't particularly happened after I added a library to the project.

Initially, I noticed the error was gone after I edited the corresponding XAML file and then hit CTRL+S. Turned out that, when I am not in the need to edit the XAML (and surely don't want to make a fake edit like adding whitespace etc.), invoking "Run Custom Tool" (right-click > run custom tool) on the XAML file works as well.

enter image description here

har07
  • 83,990
  • 12
  • 70
  • 116