0
votes

I am currently building a Xamarin Forms iOS app on top of .NET Standard v1.3. I am running into a problem with compilation of the app when I use Xamarin Studio on a Mac, but it works fine from Visual Studio on Windows, and on a separate machine running the new Visual Studio Preview for Mac.

In Xamarin Studio for Mac, I'm getting this error when compiling the app:

App.xaml.cs(25,13): error CS0103: The name `InitializeComponent' does not exist in the current context
Base/BaseView.xaml.cs(11,13): error CS0103: The name `InitializeComponent' does not exist in the current context
View/LoginView.xaml.cs(9,13): error CS0103: The name `InitializeComponent' does not exist in the current context

This happens on every XAML file in the solution. I can see why - the *.xaml.g.cs files are not being generated. On Visual Studio for Windows and Visual Studio Preview for Mac they are put into the project's obj/Release folder - but on Xamarin Studio for Mac, they aren't generated at all.

I have another Xamarin Forms app, which uses the full .NET Framework rather than .NET Standard. This app compiles fine on Xamarin Studio for Mac. This leads me to believe the problem may be .NET Standard-related.

On the main Mac I am running Xamarin Studio (6.1.5) with Mono 4.6.2, Xamarin.Android 7.0.2.42, Xamarin.iOS 10.3.1.8. On Windows I'm running Visual Studio 2015 Update 3 (14.0.25341) with Xamarin 4.2.2.11, Xamarin.Android 7.0.2.42, and Xamarin.iOS 10.3.1.8. On a second Mac I am running Visual Studio for Mac Preview 3 (7.0 build 1077) with Xamarin iOS 10.4.0.88.

I don't know if it helps at all, but in Visual Studio for Windows I also get this error in each XAML file (but the project still compiles fine):

Build action 'EmbeddedResource' is not supported by one or more of the project's targets.

Is there any reason why, on Xamarin Studio for Mac, the *.xaml.g.cs files would not be generated - perhaps related to using .NET Standard?

If I need to switch to Visual Studio Preview for Mac I'll consider it, but I'd rather not rely on a pre-release tool for a production project.

1
Xamarin does not support .net Core, may be you mean .net Standard?Gusman
Apologies - I will correct the post. Yes, .NET Standard (1.3).John
I think this is the issue: stackoverflow.com/questions/38857651/…Gusman
Thanks @Gusman - that post says that Xamarin Studio 6.0.2 onwards can consume .NET Standard libraries though, and I'm running Xamarin Studio 6.1.5.John
Consume, but not create, if you have any project targeting .net standard on the solution then it will fail. The first version to support it is 6.2 and is in the beta channel.Gusman

1 Answers

1
votes

If you have any .net Standard project included on your solution you must use Xamarin Studio version 6.2 or higher or it will fail, previous versions only allow to consume .net Standard libraries, not to compile projects of this type.