It's not all together clear to me, so I am hoping someone here knows the answer. I am using the C# Json.Net and the C# HtmlAgilityPack both built from sources for "Any CPU". I've noticed that both of these include using directives that reference assemblies that don't seem to be available in Metro yet they both build fine.
If I reference them, does this mean my app will thunk to unmanaged code?
What exactly causes thunking to unmanged code?
Why are DLLs allowed to reference assemblies that are not available to WinRT and my app is not?
Will this fail the windows store approval process?
What are the general rules for DLLs I include with my app that I need to worry about?
Thanks in advance!
When developing apps that target WinRT, the app should only use the API's available in Windows 8 WinRT. The API's are defined in WinMD files. If the app used the desktop API's, then it will be rejected during the Windows store approval process.
Imagine this scenaio. You developed a WinRT app that uses .NET DLL's from desktop mode (client profile). The app is deployed in Windows store and user downloads it on ARM tablet. The application will crash as it does not have the desktop (client) .NET DLL's on the ARM devices.
so this brings us to the question on what .NET classes we can use while developing apps for WinRT. The article http://kishore1021.wordpress.com/2012/08/06/what-is-portable-class-library-project-in-visual-studio-2012-net-4-5/ lists the .NET classes available for WinRT application development.
Change all open source projects dependencies to target WinRT. See if some methods / classes in WinRT are missing so the code does not compile. Try to find the alternative methods/classes.
Such as List.FindAll(), change to Linq Where()
Related
I would like to use nice UWP bluetooth classic APIs in my app. However my app has to be used as .exe, and it has to be portable (no installation in system). Is this possible?
The API used by UWP comes from the Windows Runtime Api, if you need to integrate Windows Runtime API in your desktop application, this is feasible.
Here is the document: Call Windows Runtime APIs in desktop apps.
But there are still some restrictions:
Due to the reference to the corresponding version of the SDK, your application can only run on the corresponding version (and above) of the Windows 10 system. May not work properly on lower version systems.
According to the description of this document, the Bluetooth API in Runtime is not yet fully supported in desktop applications.
In the description, you mentioned that you want to use portable application. Although many application functions can only be used in applications with a package identity, Windows.Device.Bluetooth is not listed here.
If the class under the Windows.Device.Bluetooth namespace has the Windows.Foundation.Metadata.DualApiPartition attribute, it means that the class can also be used directly in desktop applications, you can view related APIs in the Windows.Device.Bluetooth document.
I know, there is an issue with System.AppDomain.CurrentDomain.GetAssemblies() in the Portable Class Libraries. To overcome it, I have decided to extract the list of assemblies in the target application and send it to my PCL as custom objects.
This was easy when using single-platform applications (pure WinForms, pure WP 8 application, etc.). However, I cannot find any suitable replacement for the method in Windows 10 Universal apps (and the documentation for both PCLs and Win 10 Universal Apps is pretty bad, so far). The reason, why PCLs are not able to get a list of assemblies is simply because the library does not know of all the assemblies, until it is built and packed into DLL. However, that cannot be said of the Universal App, since it should run the same system (Windows 10) -> therefore, it should be the same program on both PC and Phone -> therefore, the application should know of all its assemblies already before compiling.
So, does there exist a suitable replacement for this method, or some workaround how to get all the assemblies inside the app?
EDIT: I have found this workaround, which loops through all .dll and .exe files... however, that seems extremely unreliable. Is there a cleaner/better way?
I'm trying to use NHunspell library in my windows phone app (available thru NuGet package).
In the Hunspell constructor i'm getting this error:
Additional information: Unable to load DLL 'kernel32.dll': The specified module could not be found.
Does anyone know how why it happens and how can i fix it? i'm running my app in the emulator, maybe this cause the issue?
The same code works fine in a simple desktop app, so i guess it is something with the project refrences or stuff like that...
And if there's someone who is familiar with this spellcheck lib and WP or in general, i'll appricaite his help.
Please help!
Thanks in advance!
In fact NHunspell uses Hunspell. Hunspell is not a native windows component as mentioned, it is a C coded spell checker library. If it is possible to use native compiled libraries on Windows Phone, someone could compile Hunspell for it, so that this can be deployed to the Phone. This would also be nice on Android and iOS in conjunction with Xamarin. Currently there is no native Hunspell library for windows phone. But this should be possible with Windows Phone 8 native support.
I have already laid the foundation for this cross platform compilation by separating the NHunspell and native Hunspell projects in the latest NHunspell version. But I'm targeting Linux x86 with this step. If someone is good at cross platform development, maybe this could be done for the mobile devices too.
This blog post describes the new build process where additional native builds can be integrated: Building NHunspell with PowerShell Build Tools
I try to reference facebook.dll - wp8 branch - within an app of type "Windows Phone Direct3D App (Native only)" project under Visual C++ VS2012, and I get the error:
a reference to [dllname] cannot be added because the two projects
target different runtimes.
The restriction is that I cannot change the architecture of the application, so the main entry-point must be in the C++ project, and from here to call somehow the code written in C# for facebook.
Based on http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj714080(v=vs.105).aspx , I tried also to reference the C# dll indirectly through a Visual C++ "Windows Phone Runtime Component" but again I get the same error. I tried to change some project settings and nothing worked. Trying to consume C# dll in C++, in all samples and demos which I found on the web, for wp8, the main entry-point is always in C#. Only some hints regarding windows store apps seem to indicate that could be possible to consume C# from C++, but I don't find any reference saying explicitly that my scenario on wp8 is possible or impossible.
How can I use facebook SDK from my WP8 app? Or what options I have?
Thanks in advance to anybody which shares the solution or any suggestion
C++ projects can't just invoke any C# DLL in WP8. You'll have to change how the class is built. Start a new C# XAML + C++ D3D project and have a look at IDrawingSurfaceManipulationHandler and Direct3DInterop. Basically you'll have to recreate and recompile the Facebook C# SDK to use it in WP8 C++.
However, installing and using the Facebook SDK on WP8 C# projects works OK on my machine. Have you considered usign a mixed C# and C++ project? It does have a small perf hit, but as long as you use DrawingSurfaceBackgroundGrid you should still have relatively good perf.
Would it be possible to code and compile C#, on a Windows 8 Tablet (WinRT) (the ARM processor edition)?
Basically it comes down to this:
Is there a C# compiler that runs on ARM?
Is there and IDE that can run in WinRT?
If the above is true, I don't see any issue, but I currently can't find if the C# compiler runs on ARM (only a lot of posts about compiling for ARM). I've also looked at SharpDevelop, and found that their source code compiles for "Any CPU", which according to this post: Windows RT and c#, means that it'll run on ARM.
Sharpdevelop however requires .NET 4.0 "Full" runtime, which I couldn't find if WinRT has or not. I'm betting it doesn't, as WinRT is supposed to be a really lightweight edition of Windows.
As a sidenote, I know that Windows tablets will come in two editions, one for ARM and one for classic processors. The classic processors will run a normal Windows 8 edition, which means it can run all the native applications. Compiling C# wouldn't be an issue here - so the question is rather, can I do the same on ARM?
This would be awesome for travelling and trying out new ideas quickly.
Currently: no, and no.
It would certainly be possible to build a Windows Store app that contains an IDE and a C# compiler. However, you would not be able to run any programs built using such an app. Windows Store apps run with reduced privileges in a sandbox. In this sandbox, the CLR will only load system assemblies and assemblies contained in the app package. The app package is immutable and cannot be modified at runtime.
Actually, the .Net framework on the surface includes csc.exe, the Csharp compiler.
I've gotten code to compile, but WinRt doesn't seem to like it being run without proper signing.
The IDE won't happen for a while, not yet at least. I'm sure that with proper signing, it is possible to run a compiled executable.
Or the other guy might be right and it isn't just an issue of signing.
I've ported SharpDevelop to run on unlocked Windows RT devices, it works at least for C# Windows Forms apps. http://chentiangemalc.wordpress.com/2013/03/18/sharpdevelop-rt-edition-beta-code-windows-forms-directly-on-windows-rt/