I created a new UWP app and wanted to load an XML file using the xelement class.
While looking on mdsn, I see I can do this using the load(string) method
https://msdn.microsoft.com/en-us/library/system.xml.linq.xelement(v=vs.110).aspx
In my UWP project the xelement is missing the Load method.
Why is this happening ?
Is it because I am not actually using the .NET while building UWP apps ? Or I am using a subset of .NET while building UWP apps ?
While looking on msdn how can I verify if a method from a .NET class is also available while developing a UWP app ?
Is it because I am not actually using the .NET while building UWP apps ? Or I am using a subset of .NET while building UWP apps ?
The .Net APIs that can be used in UWP apps is called .NET for UWP apps. .NET for UWP apps provides a set of managed types that you can use to create Universal Windows Platform apps for Windows 10 using C# or Visual Basic. Note that .NET for UWP apps includes a subset of the types provided in the full .NET Framework for each namespace.
While looking on msdn how can I verify if a method from a .NET class is also available while developing a UWP app ?
As #Paweł Hemperek said, usually, we can find if a .NET Framework class is available in UWP apps by checking the Version Information in the bottom of the document. If we can find Universal Windows Platform under Version Information then we should be able to use this class in UWP apps.
But please note that one class can be used in UWP not means that all of its properties and methods are available in UWP. For example, XmlElement Class is available in UWP, but XmlNode.SelectSingleNode Method (String) can't be used in UWP apps.
Related
I have developed a UWP class library , and it is already used in various projects.
Now I want to make this UWP class library to support WindowsAppSdk apps too.
When I try to refer UWP Library in WindowsAppSdk app, getting error like "Project is not compatible".
My UWP class library min supported version - Windows 10 fall creators update (16299).
Should I recreate my UWP Library as WindowsAppSdk library ?
Can anyone help me understand this
Thanks
Noorul.
Should I recreate my UWP Library as WindowsAppSdk library ?
No, but you should convert it into a .NET Standard library that can be consumed by both UWP and WinUI (.NET) applications, and any other type of application whose runtime implementation supports the version of the .NET Standard specification that you choose to target.
UWP apps cannot consume librararies that are targeted against a specific platform such as .NET and vice versa. That's where .NET Standard comes in. It enables you to share code across multiple .NET implementations and platforms.
I hope isn't a stupid question...
Is possible to load a no silverlight assembly into a silverlight project without using a COM object?
Thanks in advance.
You can use the Portable Class Library (PCL)
Use this project to write and build portable assemblies that work
without modification on multiple platforms, such as Windows 7, Windows
8, Silverlight, Windows Phone, and Xbox 360. For example, you can
create classes that contain shared business logic for desktop apps,
Windows Store apps, and mobile apps, and you can then reference those
classes from your apps.
The Portable Class Library project supports a subset of assemblies
from the .NET Framework, Silverlight, .NET for Windows Store apps,
Windows Phone, and Xbox 360, and provides a Visual Studio template
that you can use to build assemblies that run without modification on
these platforms. If you don't use a Portable Class Library project,
you must target a single app type, and then manually rework the class
library for other app types. With the Portable Class Library project,
you can reduce the time and costs of developing and testing code by
building portable assemblies that are shared across apps for different
devices.
Also, Microsoft's Scott Hanselman has written a few articles about the PCL, this one should be a good starting point to find the resources you need to get started: Cross-Platform Portable Class Libraries with .NET are Happening
I have a problem with the Marshal class in the System.Runtime.InteropServicenamespace.
In my project map I have a Windows Phone 8, a Windows Store and a Portable Class Library project.
I can easily use the Marshalclass in the Windows Phone 8 and Windows Store project, but not in the Portable Class Library. This class can not be found there.
By settings, the Portable Class Library support the .Net 4.5 Framework, Windows Phone OS 8.0 and Windows Store.
You cannot access Marshal class in Portable Class Library project with support of anything else than .NET Framework and Windows Store App - by design of .NET Framework as stated in resolution of relevant bug of .NET Framework.
Added below a screenshot as at MS Connect they tend to delete defects (as here) from time to time:
In my Windows Phone project for SDK 7.1 (maybe I need to update it to use WP8 later) I want to add a test image into Windows Phone Emulator using this code. The latter uses MediaLibrary class and so I have to add a reference to Microsoft.Xna.Framework. No other code in my project needs that assembly.
I've found this MSDN document that says You can use certain XNA Framework assemblies in apps that target Windows Phone OS 8.0. and the list includes Microsoft.Xna.Framework.dll. So looks like I should not expect any problems but I'm not completely sure.
Will using MediaLibrary class and so having a reference to Microsoft.Xna.Framework cause any issues with portability of my code and its distribution?
No you can safely use MediaLibrary and other permitted Xna assemblies in your WP8 projects. In fact, The Rich media extensibility which adds certain extension methods to some classes in the Xna framework are exclusively available for WP8 only.
Is it possible to use Google APIs Client Library for .NET in a WP7 project?
I've tried to add a new reference to DotNetOpenAuth.dll and I'm getting the folowing error.
Reference cannot be added to DotNetOpenAuth.dll because it was not built using the Windows Phone runtime. Windows Phone projects will work only with Windows Phone assemblies.
Is it possible to solve?
Try Portable Library Tools from MSDN. Read about them here. Now reference Google .Net library in the portable library, also reference this portable library project in WP7 project. Now, write a small wrapper over the Google apis in the portable library project and use them from your WP7 project. Referencing works but I did not use it, you can give it a try once.
I would think it would be possible to use the Google APIs from WP7. I've not used them myself, but it looks like you use them by making HTTP requests which, if memory serves me right, is possible on WP7.
With regards to the DotNetAuth.dll it is more then likely built against the Full or Client Profile version of the .NET Framework and therefore can't be used by WP7. In order to do this, then a WP7 specific version of the assembly will be have to be compiled.