Windows 10: How do you create a PhoneLine class? - c#

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

As the error says ,
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 Windows.Foundation.UniversalApiContract dll to the project as reference

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.

Related

Problem using Windows.Devices.Bluetooth.GenericAttributeProfile reference

I am trying to use the C# library GattCharacteristic and I'm having trouble with references. I used Nuget to get the UwpDesktop package which was a suggestion posted elsewhere.
'Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic' in assembly 'Windows' causes a cycle.
The type name 'GattCharacteristic' could not be found in the namespace 'Windows.Devices.Bluetooth.GenericAttributeProfile'. This type has been forwarded to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider adding a reference to that assembly.
I've also tried adding the windows.winmd reference and adding <TargetPlatformVersion>10.0</TargetPlatformVersion> to the .csproj file with no success.

Xamrain form build task reference error in visual studio 2017

I am using visual studio 2017 and when I install xamrain from build 3.0 then I get the error bellow running application. How to resolve this problem?
Severity Code Description Project File Line Suppression State
Error The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be
loaded from the assembly
D:\Practics\AndroidApp\packages\Xamarin.Forms.3.0.0.561731\build\netstandard2.0\Xamarin.Forms.Build.Tasks.dll.
Could not load file or assembly 'netstandard, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its
dependencies. The system cannot find the file specified. Confirm that
the declaration is correct, that the assembly and all its
dependencies are available, and that the task contains a public class
that implements
Microsoft.Build.Framework.ITask. AndroidApp.Android D:\Practics\AndroidApp\packages\Xamarin.Forms.3.0.0.561731\build\netstandard2.0\Xamarin.Forms.targets 36
Severity Code Description Project File Line Suppression State Error The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be
loaded from the assembly
D:\Practics\AndroidApp\packages\Xamarin.Forms.3.0.0.561731\build\netstandard1.0\Xamarin.Forms.Build.Tasks.dll.
Could not load file or assembly 'netstandard, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its
dependencies. The system cannot find the file specified. Confirm that
the declaration is correct, that the assembly and all its
dependencies are available, and that the task contains a public class
that implements
Microsoft.Build.Framework.ITask. AndroidApp D:\Practics\AndroidApp\packages\Xamarin.Forms.3.0.0.561731\build\netstandard1.0\Xamarin.Forms.targets 36
Well, This is xamarin-forms v 3.0 known issue with visual studio 2017. I faced same issue on last week (ref : https://bugzilla.xamarin.com/show_bug.cgi?id=60293).
Fix : Install .NET framework 4.7.1. from Microsoft(https://www.microsoft.com/en-us/download/details.aspx?id=56116) and then restart your system.

ICloneable Exists in Two Assemblies

Our dot net core 2.0 project has some classes that implement ICloneable (they have a .Clone() method that returns an object). Now, we are using a package Microsoft.Azure.Amqp and when building the project now gives an error:
Error CS0433 The type 'ICloneable' exists in both 'Microsoft.Azure.Amqp, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Both have ICloneable in the "System" namespace, so how can the compiler know which one to use? Is there a way to say which DLL to use for that reference?
The question here has a solution to this problem. I'll summarise it briefly. Go to the reference in your project, and change "Aliases" to a value of your choosing. To use code from this assembly now, you will need to use the extern keyword like so at the top of your file: extern alias aliasname. Then you can reference code from this assembly like so: aliasname::System.ICloneable.

The type 'Attribute' is defined in an assembly that is not referenced

Hello I am working on a Xamarin cross platform application using PCL for code sharing, and when I try to build the solution, I have the following error message:
Error CS0012 The type 'Attribute' is defined in an assembly that is
not referenced. You must add a reference to assembly 'System.Runtime,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
I am targeting version 4.5 of the .NET framework. This error occured when I build, on a file generated in the obj folder.
I tried changing the references of the project but the only reference is "NET" (version 4.0.0) and I can't delete it nor add any other system reference so I don't know what to do.

C# Using and Compiling Windows.Form

I am working on coding a GUI with C#. I'm following this simple tutorial to get started. To compile, I need to reference System.Windows.Forms.DLL System.Drawing.DLL, so I type
csc /r:System.Windows.Forms.DLL /r:System.Drawing.DLL FirstForm.cs
However, I get errors like this:
FirstForm.cs(6,14): error CS0012: The type 'System.ComponentModel.Component' is
defined in an assembly that is not referenced. You must add a reference
to assembly 'System, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Windows.Forms.dll:
(Location of symbol related to previous error)
I've already added "c:\Windows\Microsoft.NET\Framework\v4.0.30319" to my path. I don't know why it's telling me to reference it when I already have.
You need to add /r:System.DLL to your command line arguments

Categories

Resources