Xamarin: Build action ‘EmbeddedResource’ is not supported by one or more of the project’s targets

Xamarin.Forms

The Xamarin.Forms error that shows mainly when you upgrade the nuget to a new Xamarin.Forms version:

Error CS0117 Build action ‘EmbeddedResource’ is not supported by one or more of the project’s targets.

Is a very nasty error that stops your work, and at least for me, even un-installing the latest version of Xamarin.Forms, and going back to older versions, did not fix the problem.

So, the following solution is a work-around that makes your solution compiles, and makes it workable on the devices:

this bug is filed here:

https://bugzilla.xamarin.com/show_bug.cgi?id=39910

The

 

Adding the Resource.cs file

  1. Add to your .Droid project one of the following files:

don’t forget to change the namespace from “SampleBrowser.Droid” to the one used in the “Resource.Designer.cs”.

 🔘 Resource.cs; this has its values taken from Prism-Samples down bellow:

https://docs.google.com/document/d/1zzLwTiauoAlHHgaJvH5jXbM5743H21xvGcxuN0z8Xfo/edit?usp=sharing

because of the “Part 1 – Android Resource Basics” article:

https://developer.xamarin.com/guides/android/application_fundamentals/resources_in_android/part_1_-_android_resource_basics

I used the following file as a guide:

https://github.com/PrismLibrary/Prism-Samples-Forms/blob/master/UsingDependencyService/UsingDependencyService/UsingDependencyService.Droid/Resources/Resource.Designer.cs

i took the values for the “public const int[] Theme” constant from the Prism-Samples file.

.

 🔘 ResourceDiffrent.cs; This has its values written in big numbers to foresee any clashes with the auto generated ones:

https://docs.google.com/document/d/12PcMIxAhKz0HCf4ZMhlC8TfKPagDub_5EMJtHaToYXo/edit?usp=sharing

i did not fill the array variable: public const int[] Theme in the “ResourceDiffrent.cs” file, because it will take too much time, so the overall picture, is that it will stop the compiler from complaining, but don’t know what are the run time issues that might arise because of this.

.

It will add partial classes to the classes under the “Resource.Designer.cs” file, and inside them, are the missing constants, and if you have more missing constants than whats in the above, then feel free to add them to the file.

Clean Solution

2. Right click on your solution, and select “Clean Solution” from the popup menu.

3. Close Visual studio.

Delete Folders

4. Browse to your solution folder with Windows Explorer, and search for the following folders:

  • Obj
  • Debug
  • Release

and delete all these folders.

 

5. Open VS 2015 As admin, or you can make the icon open as admin always by following this:

http://www.cnet.com/how-to/always-run-a-program-in-administrator-mode-in-windows-10

compile the hole solution, and hopefully it will work, as it did with me.

 

This workaround worked with syncfusion xamarin community edition samples:

http://www.syncfusion.com/products/communitylicense

And also it worked with a test project that i added to it XLabs nuget, and only the error of : “InitializeComponent”, that did not get solved, and which i think that the following warning might have something in it:

Severity Code Description Project File Line Suppression State
Warning Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the “runtime” node in the application configuration file: <assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″><dependentAssembly><assemblyIdentity name=”XLabs.Serialization” culture=”neutral” publicKeyToken=”d65109b36e5040e4″ /><bindingRedirect oldVersion=”0.0.0.0-2.0.5782.15703″ newVersion=”2.0.5782.15703″ /></dependentAssembly></assemblyBinding><assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″><dependentAssembly><assemblyIdentity name=”Newtonsoft.Json” culture=”neutral” publicKeyToken=”30ad4fe6b2a6aeed” /><bindingRedirect oldVersion=”0.0.0.0-8.0.0.0″ newVersion=”8.0.0.0″ /></dependentAssembly></assemblyBinding> Trainer.Droid

 

The remaining Errors of the CS0117 in the resources file:

 

Severity Code Description
Error CS0117 ‘Resource.Dimension’ does not contain a definition for ‘dialog_fixed_width_major’
Error CS0117 ‘Resource.Attribute’ does not contain a definition for ‘mediaRouteSettingsDrawable’
Error CS0117 ‘Resource.Dimension’ does not contain a definition for ‘design_tab_min_width’
Error CS0117 ‘Resource.Dimension’ does not contain a definition for ‘dialog_fixed_height_major’
Error CS0117 ‘Resource.Dimension’ does not contain a definition for ‘dialog_fixed_height_minor’
Error CS0117 ‘Resource.Dimension’ does not contain a definition for ‘dialog_fixed_width_minor’
Error CS0117 ‘Resource.Dimension’ does not contain a definition for ‘mr_media_route_controller_art_max_height’
Error CS0117 ‘Resource.Drawable’ does not contain a definition for ‘ic_setting_dark’
Error CS0117 ‘Resource.Drawable’ does not contain a definition for ‘ic_setting_light’
Error CS0117 ‘Resource.Drawable’ does not contain a definition for ‘mr_ic_settings_dark’
Error CS0117 ‘Resource.Drawable’ does not contain a definition for ‘mr_ic_settings_light’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘art’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘buttons’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘default_control_frame’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘disconnect’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘media_route_control_frame’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘media_route_list’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘media_route_volume_layout’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘media_route_volume_slider’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘play_pause’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘route_name’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘settings’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘stop’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘subtitle’
Error CS0117 ‘Resource.Id’ does not contain a definition for ‘title_bar’
Error CS0117 ‘Resource.Layout’ does not contain a definition for ‘mr_media_route_chooser_dialog’
Error CS0117 ‘Resource.Layout’ does not contain a definition for ‘mr_media_route_controller_material_dialog_b’
Error CS0117 ‘Resource.Layout’ does not contain a definition for ‘mr_media_route_list_item’
Error CS0117 ‘Resource.String’ does not contain a definition for ‘mr_media_route_button_content_description’
Error CS0117 ‘Resource.String’ does not contain a definition for ‘mr_media_route_chooser_searching’
Error CS0117 ‘Resource.String’ does not contain a definition for ‘mr_media_route_chooser_title’
Error CS0117 ‘Resource.String’ does not contain a definition for ‘mr_media_route_controller_disconnect’
Error CS0117 ‘Resource.String’ does not contain a definition for ‘mr_media_route_controller_no_info_available’
Error CS0117 ‘Resource.String’ does not contain a definition for ‘mr_media_route_controller_pause’
Error CS0117 ‘Resource.String’ does not contain a definition for ‘mr_media_route_controller_play’
Error CS0117 ‘Resource.String’ does not contain a definition for ‘mr_media_route_controller_settings_description’
Error CS0117 ‘Resource.String’ does not contain a definition for ‘mr_media_route_controller_stop’
Error CS0117 ‘Resource.Style’ does not contain a definition for ‘RtlOverlay_Widget_AppCompat_ActionButton_Overflow’

 

Other Xamarin Errors:

https://readerman1.wordpress.com/2016/05/11/xamarin-forms-errors/

 

 

About Reader Man حسين ناجي الصفافير

حسين ناجي الصفافير Hussain Naji Al-Safafeer Info: https://readerman1.wordpress.com/aboutme
This entry was posted in Bugs and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s