Har Har - 3 months ago 54
C# Question

Windows 10: How do you create a PhoneLine class?

I would like to programatically make a call with my windows phone 10, however I have no idea how to create a PhoneLine class can someone point me how to do it?

I am both new to C# and the mobile world.

I found the API reference here:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.calls.phoneline

and what I attempted to do is:

new Windows.ApplicationModel.Calls.PhoneLine();


However what I get is:

Severity Code Description Project File Line Suppression State
Error CS1069 The type name 'PhoneLine' could not be found in the
namespace 'Windows.ApplicationModel.Calls'. This type has been forwarded to
assembly 'Windows.Foundation.UniversalApiContract, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider
adding a reference to that assembly. App2 C:\documents\visual studio
2015\Projects\Helloworld2\App2\MainPage.xaml.cs 33 Active

Answer

If you read the error carefully you can see that it says this:

"This type has been forwarded to assembly 'Windows.Foundation.UniversalApiContract, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider adding a reference to that assembly."

You need to add a reference to the Windows.Foundation.UniversalApiContract assembly, as the class you are looking for has been moved over there instead.

According to this blog it can be found here:

C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0\Windows.Foundation.UniversalApiContract.winmd

Remove (x86) from the path if you're on a 32-bit system.

Comments