Type WriteableBitmap is defined in an assembly that is not referenced System.Windows

862 Views Asked by At

I am trying to create a Windows Phone 8.1 project, but I got an error saying The type 'WriteableBitmap' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows, Version=2.0.6.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e', but I can't find that assembly anywhere.

I tried to let Visual studio fix it for me, but then it came with this error Error from Visual Studio.

My using is set to

using eKomplet.Services;
using eKomplet.WinPhone8.Implementations;
using Microsoft.Phone;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;

And one of the lines, that fails are var bitmap = PictureDecoder.DecodeJpeg(imageStream);, where it gets PictureDecoder from Microsoft.Phone

I am using these NuGet packages

Acr.UserDialogs               5.2.2
Acr.XamForms.UserDialogs      5.2.2
Coding4Fun.Toolkit.Controls   2.1.8
ExifLib.PCL                   1.0.1
MR.Gestures                   1.3.4
Newtonsoft.JSON               8.0.3
Splat                         1.6.2
SQLite.Net.Core-PCL           3.1.1
SQLite.Net-PCL                3.1.1
Xam.Plugins.Settings          2.1.0
Xamarin.Forms                 2.0.0.6482
Xamarin.Insights              1.10.6
XLabs.Core                    2.0.5782
XLabs.Forms                   2.0.5782
XLabs.IoC                     2.0.5782
XLabs.Platform                2.0.5782
XLabs.Serialization           2.0.5782

How can I fix this?

UPDATE
In Reference Manager Assemblies -> Framework tells me All of the Framework assemblies are already referenced. Please use the Object Browser to explore the references in the Framework.
Assemblies -> Extensions tells me No user assemblies were found on the machine.
Projects just shows the projects in the solution.
Shared Projects do not show anything
Windows Phone 8.1 -> Core tells me The Windows Phone 8.1 SDK is already referenced. Please use the Object Browser to explore the references in the Windows Phone 8.1 SDK.
Windows Phone 8.1 -> Extensions shows me

Behaviors SDK (XAML)                                          12.0
Microsoft Visual C++ 2013 Runtime Package for Windows Phone   12.0
Microsoft Visual Studio Test Core                             14.0
MSTest for Managed Projects                                   14.0
SQLite for Windows Phone 8.1                                  3.13.0

Browse shows me nothing

UPDATE 2
The problem also occurs in App.xaml.cs for this line new XFormsAppWP().Init(this);, so I think it must be something related to this XLabs issue. But did anyone find a fix or workaround for it?

UPDATE 3
I have used PictureDecoder from Microsoft.Phone, but you can only use Microsoft.Phone in Silverlight projects. In Windows Phone 8.1 you have to use BitmapDecoder.

0

There are 0 best solutions below