Bug 45404 - [Windows 8.1 SDK] compile error after upgrade to
Summary: [Windows 8.1 SDK] compile error after upgrade to
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Xamarin.Forms ()
Version: 4.2.0 (C8)
Hardware: PC Windows
: Normal normal
Target Milestone: Future Cycle
Assignee: Bugzilla
Depends on:
Reported: 2016-10-14 12:56 UTC by cliff
Modified: 2017-12-15 00:51 UTC (History)
9 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description cliff 2016-10-14 12:56:07 UTC
Upgrading from to causes this error now:

 XamlCompiler error WMC1007: Cannot resolve 'Windows.metadata'.  Please install the Windows Software Development Kit. You can retarget your project to Windows 8.1. The Windows 8.1 SDK is installed with Visual Studio. See http://go.microsoft.com/fwlink/?LinkID=278967&clcid=0x409 for more information on how to retarget your project

This comes from a PCL targeting .NetSTandard 1.3.

Also getting this error for android project:

9>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018: The "ResolveLibraryProjectImports" task failed unexpectedly.
9>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018: System.IO.FileNotFoundException: Could not load assembly 'PROJECT, Version=, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
9>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018: File name: 'PROJECT.dll'
9>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
9>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters)
9>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
9>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
9>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
9>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
9>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
9>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
Comment 1 Stephen Marcus 2016-12-10 22:32:05 UTC
Hi, me too... please add me to the response list.
Comment 2 Jose Gallardo 2016-12-28 18:04:47 UTC
Hi Cliff, Stephen,

Can you please confirm what PCL Profile number is used in your PCL project? You can see that in your csproj file, it looks like:

Comment 3 Mitchell Wheeler 2017-01-05 04:16:42 UTC
I can confirm this issue, it's a complete blocker - our office can't use Xamarin.Forms in VS at all because of this as there's seemingly no way to downgrade to a specific version that doesn't have this problem.

PCL profile: Profile44
Comment 4 Jose Gallardo 2017-01-05 04:32:59 UTC
Hi Mitchell,

Can you please share the full environment information?

Go to the menu "Help - About Microsoft Visual Studio" and press "Copy Info". Please paste that info into a Bugzilla comment.

Also, it will be great if you can at least describe your solution structure, to see what kind of projects do you have and how are they referencing each other.

Just in case, it seems like this kind of error can show up on VS 2013 after updating the Windows SDK and not updating VS 2013 itself (not Xamarin related). Can you please double check that all the products are up-to-date.

Comment 5 Mitchell Wheeler 2017-01-05 11:48:01 UTC
I'm actually using VS2015 myself.

I have spent some time figuring out the cause of the error (but haven't managed to cause a new project to generate the broken msbuild, so it 'might' only happen to projects being upgraded over time 'or' who were created some time ago, or it might just be that I haven't figured out how to cause the error in a new project yet).

The problem stems from Xamarin XAML files w/ an MSBuild item definition roughly as follows:
    <Page Include="Page1.xaml">

When in reality, a Xamarin XAML file should look like this (at least, this is how they look when I add a new one in VS & it's how the vast majority of my existing XAML files also look even in the broken project):
    <EmbeddedResource Include="Page1.xaml">

I'm not sure how my old project has ended up w/ such an item definition, the only thing I am certain of is removing the affected XAML files and re-adding them corrects the MSBuild and removes the error.

Another important note (having dug through my source control to see when this msbuild was added / from where) is 1) these projects were created in Visual Studio 2015 (I'm not sure what Xamarin version, sorry) and most importantly 2) the bad Xamarin XAML files were added to the project from Xamarin Studio (from macOS, again unsure if Xamarin version when they were added).

If I had to take an uneducated stab in the dark, I'd say maybe once upon a time the MSBuild item collection name for Xamarin XAML files was 'Page' and it was later changed to simply use the standard EmbeddedResource collection... and in this latest upgrade support for the old 'Page' collection was removed & it's now being reinterpreted by something else which causes this error (maybe some other Microsoft related XAML MSBuild task is picking it up? I'm not sure)

== Full environment info below, but I'm not sure it's relevant given my findings ==

Microsoft Visual Studio Community 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Community

Visual Basic 2015   00322-20000-00000-AA242
Microsoft Visual Basic 2015

Visual C# 2015   00322-20000-00000-AA242
Microsoft Visual C# 2015

Visual C++ 2015   00322-20000-00000-AA242
Microsoft Visual C++ 2015

Visual F# 2015   00322-20000-00000-AA242
Microsoft Visual F# 2015

Application Insights Tools for Visual Studio Package   7.15.01215.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1   14.1.20907.0
ASP.NET and Web Tools 2015.1

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
For additional information, visit http://www.asp.net/

Azure App Service Tools v2.8.1   14.0.11123.0
Azure App Service Tools v2.8.1

Clang with Microsoft CodeGen   14.0.25516
Clang with Microsoft CodeGen

CodeXL   2.2
CodeXL is a comprehensive tool suite that enables developers to get the most out of AMD CPUs, GPUs and APUs.
CodeXL includes GPU debugging, GPU and CPU profiling and static OpenCL™ kernel analysis capabilities, enhancing accessibility for software developers to enter a new era of parallel programming.
CodeXL comes as both a Microsoft® Visual Studio® extension and as a standalone application for the Windows® and Linux operating systems.

© 2015 Advanced Micro Devices, Inc.  All rights reserved.  AMD, the AMD Arrow logo, CodeXL, the CodeXL logo and combinations thereof are trademarks of Advanced Micro Devices, Inc.

Command Bus, Event Stream and Async Manager   Merq
Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

Common Azure Tools   1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Microsoft .NET Core Tools (Preview 2)   14.1.20907.0
Microsoft .NET Core Tools (Preview 2)

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager   3.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

NVIDIA CUDA 8.0 Wizards   8.0
Wizards to create new NVIDIA CUDA projects and source files.

NVIDIA Nsight Visual Studio Edition
NVIDIA Nsight Visual Studio Edition provides tools for GPGPU and graphics development.  Copyright © NVIDIA 2010 - 2016.
•Direct3D® and DirectX® are registered trademarks of Microsoft Corporation in the United States and/or other countries.
•Microsoft Detours is used under the Professional license (http://research.microsoft.com/en-us/projects/detours/).
•Gardens Point Parser Generator Copyright 2005 Queensland University of Technology (QUT). All rights reserved.
•NLog Copyright © 2004-2006 Jaroslaw Kowalski (jaak@jkowalski.net)
•IronPython and WPFToolkit used under Microsoft Public License (Ms-PL) and are Copyright © Microsoft Corporation
•Portions of RadControls for WPF © 2010-2011 by Telerik Corporation.  All rights reserved.
•zlib and libpng used under the zlib/libpnc license (http://opensource.org/licenses/Zlib) 

Warning: This computer program is protected by copyright law and international treaties. Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under the law.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.60519.0
Microsoft SQL Server Data Tools

TypeScript tools for Visual Studio

Visual Studio Tools for Unity
Visual Studio Tools for Unity

Visual Studio Tools for Universal Windows Apps   14.0.25420.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin (27a9b40)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (501e63c)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS (8b53676)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 6 Mitchell Wheeler 2017-01-05 12:17:06 UTC
A quick edit to the above info:  After a bit of double-checking, I can't in fact determine with certainty the incorrect MSBuild was added from Xamarin Studio.

It's probably worth noting at least in our case, the XAML files in question weren't actively used in the clients (they were still being designed), so while they may have previously 'compiled' before this latest Xamarin update, I'm not sure the invalid MSBuild would have worked at runtime...

In that sense, I now see this error as what it is - the correct detection of a real compilation error that previously went by unnoticed (though the error message doesn't make it clear what the problem is, let alone the fix).
Comment 7 Jose Gallardo 2017-06-29 14:00:08 UTC
Thanks for the provided info.
Marking the bug resolved answered.
Comment 8 Melbourne Developer 2017-09-04 00:07:08 UTC
I'm getting this error as well. I created a .NET Standard 1.4 library which also target PCL. Project.json:

  "supports": {},
  "dependencies": {
    "NETStandard.Library": "2.0.0",
    "System.ComponentModel": "4.3.0",
    "Xamarin.Forms": ""
  "frameworks": {
    "netstandard1.4": {
      "imports": "portable-win+net45+wp8+win81+wpa8"

It compiles fine until I add any XAML page with a code behind. I.e. I can compile a class that inherits from a Xamarin Forms class, but if I add a xaml that has a type of "Page", the code behind is generating code, and the compiler thinks that the code is meant to be built for Windows 8.1 but it's not. It's meant to be build for Xamarin Forms.
Comment 9 Laura 2017-12-15 00:51:56 UTC
I fixed this by finding a <Page /> element in my PCL .csproj and changed it to an <EmbeddedResource /> element.

Here's the change I made in my repository:
-    <Page Include="Adapt\Presentation\XivicControls\ModalRecordSearchPicker.xaml">
+    <EmbeddedResource Include="Adapt\Presentation\XivicControls\ModalRecordSearchPicker.xaml">
-    </Page>
+    </EmbeddedResource>

Apparently <Page /> will mess up PCL projects in Xamarin.Forms.