Hi I am trying to use the Windows.ApplicationModel as in this example
https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/Package
However I am unable to import the dll.
using Windows.ApplicationModel;
results in an error although I am using .NET Version where it should exist. Also I cannot find it when I try to add the reference.
Any Ideas?
I need it to get some packe Informations about Programs that run in the ApplicationFrameHost.
From what I can tell, you need the Windows SDK 17134 version that comes with the UWP development package in the installer. Then you can use that namespace. Google also led me to this link which might help: https://blogs.windows.com/buildingapps/2017/01/25/calling-windows-10-apis-desktop-application/
Related
I've been attempting to make grpc work (ssl http2) on Xamarin Forms and after some pain I managed to get it to work on Android using Grpc.Core. However I couldn't get iOS to compile. Working through this problem I was trying to get anything grpc related to work on iOS, and eventually found the grpc experimental xamarin demo, HelloworldXamarin. Found here:
https://github.com/grpc/grpc/tree/master/examples/csharp/HelloworldXamarin
I downloaded the solution, but when I try to compile it I get the following errors:
Error Text:
Native linking failed, undefined symbol: operator delete(void*). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
Native linking failed. Please review the build log and the user flags provided to gcc: -LC:/g/examples/csharp/HelloworldXamarin/packages/Grpc.Core.2.23.0/build/Xamarin.iOS10/../../native/ios/universal -lgrpc_csharp_ext -force_load C:/g/examples/csharp/HelloworldXamarin/packages/Grpc.Core.2.23.0/build/Xamarin.iOS10/../../native/ios/universal/libgrpc_csharp_ext.a -LC:/g/examples/csharp/HelloworldXamarin/packages/Grpc.Core.2.23.0/build/Xamarin.iOS10/../../native/ios/universal -lgrpc -force_load C:/g/examples/csharp/HelloworldXamarin/packages/Grpc.Core.2.23.0/build/Xamarin.iOS10/../../native/ios/universal/libgrpc.a
linker command failed with exit code 1 (use -v to see invocation)
For the warning regarding not being able to find libgrpc_csharp_ext.a, I verified that the file was there.
There appears to be some issue with native linking, which I am very unfamiliar with. I'm using nearly the latest Visual Studio (well, 16.5.3), a mac build host with latest OS and XCode updated to latest. Didn't make any changes to the files pulled from git. I only just started working with Xamarin iOS this week, so everything should be in a fairly "default" state.
What could be wrong with my setup/system that makes this not work? I understand that this is an experimental feature still, but I can't tell if I've done something stupid or if there's been some change in something (like XCode? or it needing VS 2017?) that makes this no longer work? Is anyone else able to get this example to compile?
I've also tried newer versions of the grpc nuget packages and that only resulted in more errors.
Ultimately I'm trying to get latest Grpc.Core to work in iOS on Xamarin.Forms, though I have very little experience working with iOS. If there are issues with the latest versions of XCode/Visual Studio/Grpc.Core that are causing this, I'm willing to try to work through them, if someone can point me in the right direction.
It is not at all related to your versions or something that you did or didn't do.
First for some theory:
If someone wants to use Objective-C libraries or CocoaPods packages in their Xamarin project, they will need to create a binding library for this. Take it as some sort of a "bridge" between the native implementation and the later exposed C# code that you can use. You can learn more about the binding from the official documentation here and more specifically here.
To sum up the info - after the bindings have been created, you see a .lib or .a file. This is exactly what they have done - exposed some native code into the libgrpc_csharp_ext.a. Unfortunately, there are some bindings that are not correct. This is exactly what you are seeing here - the aftermath of an incorrect binding.
Looking a bit into the project I got to the following conclusions:
There is an open issue from May 2019 about this - https://github.com/grpc/grpc/issues/19172
Unfortunately, the issue is still active and there is no movement there.
I have confirmed that after version 1.21 (incl.) the build is not working. For now, you can downgrade to version 1.20.1 (last known to work). I have successfully built the solution with it. Please review the changelog and release notes for this specific version (if any) so that you know if it will fit your needs.
Basically, you have 2 options:
Downgrade to the last good version in order to use it;
If you want to use the latest version either wait for the issue to be fixed, or fork the repo and help with the fixing.
If you want to see their build script and help fix the issue, you can start from here.
Another useful resource is this video from the official Xamarin channel.
I am trying to open a pdf file on the browser, acrobat or any other default pdf program. For this I need to call LaunchFileAsync() and I need to reference Windows.System to be able to use it. However, this is not working and I can't call any reference.
I tried looking for a specific library or nuget package but I couldn't find anything. The documentation just tells me to use that namespace but it doesn't say anything about how to add the reference. I also tried using a different approach by calling System.Diagnostics.Process.Start(path) and some variations but it doesnt't work using Xamarin apparently.
This is basically what I am trying to implement but there's no namespace found event though I did try implementing it.
string uriToLaunch = #"file://" + #file;
var uri = new Uri(uriToLaunch);
var success = await Windows.System.Launcher.LaunchUriAsync(uri);
Any help would be appreciated.
Have you tried adding an assembly reference in the Reference menu?
In the Solution Explorer, right click your project and go to:
Add -> Reference -> Assemblies -> System.*
Also, make sure not to use platform specific libraries for a mobile project, since this will probably cause compatibility issues. .NET Standard is the way to go.
Use Xamarin.Essentials as it defines the various OS dependancies for you and on UWP uses the native Windows.System.Launcher.LaunchUriAsync:
Xamarin.Essentials.Launcher.OpenAsync
re: Xamarin Docs
Note: Opening file://-based URIs is very restricted in UWP.
If you are not targeting .NET Standard yet, make sure you do that if you want to use System libraries. There are some tutorials on this, but i highly suggest you backup your project before changing from PCL to .NET Standard
I'm trying to create a class library for the new Microsoft Identity model but am being beaten back by an odd error.
If I create a regular C# Class Library (not a PCL) and attempt to install Microsoft.AspNet.Identity.EntityFramework.3.0.0-rc1-final via Nuget it goes so far, chokes, rolls back and then displays the following error:
Failed to add reference to 'System.Runtime'. Please make sure that it
is in the Global Assembly Cache.
I know that this is a pre-release version of the library but this cannot be such a radical idea that I'm trying to achieve here.
Any pointers greatly appreciated.
It seems to be a known issue and confirmed by Microsoft. It leads to this NuGet issue.
A workaround, according to the comments, is to install Microsoft.AspNetCore.Identity.EntityFrameworkCore, which is the RC2 equivalent. From what I can find this hasn't been officially released yet, and you might need to build from source.
I started off from the thread to [decode data matrix in C#] (How To Use ZXing C# Port)! but I am encountering an error that prevents me from using zxing.
error states: "The type or namespace name 'com' could not be found (are you missing a using directive or an assembly reference?)"
In my code i am (trying to) use:
using com.google.zxing;
Please let me know what I am doing wrong.
It'd be nice if C# could automatically detect the references you're using and download them, but this is not the case. You need to download the ZXing SDK and reference it before using it.
The easiest way to do so is via NuGet, which is built in Visual Studio from 2012 onwards, and available for VS 2010. Right-click on your project, click on "Manage NuGet Packages", then select "Online" from the left-hand menu and search with the search box in the top right.
There are two ZXing ports available on NuGet, so you'll have to look at them both and pick the one that seems right for you.
You can also find some ZXing DLL on the Internet and reference it from your project: right-click on your project's "References", click on "Add reference..." then on the "Browse" button.
However, that is not as convenient as NuGet because you need to manually check for updates to the library, and update the DLL, whereas NuGet will tell you when an update is available (it won't force you to update).
Just by looking at your code sample, I wouldn't suggest using a port that uses Java-like namespaces (a more C#-y version would be e.g. "Google.ZXing"), since it sounds like a "dumb" port that simply converted the Java syntax to C# without thinking about whether some C# features are better at doing whatever the original library wanted to do.
I've used ZXing.Net v0.14 in a Windows Phone app and it works well.
You have to replace
using com.google.zxing;
with
using ZXing;
if you are referencing and using the ZXing.Net assemblies.
I replaced the Java-stylish namespaces with a more .Net like version.
Old sample around the web doesn't work with ZXing.Net.
In the source code repository and the download section of ZXing.Net you will
find some more up-to-date samples. You should really start with the newer samples because I wrote some simplifications on top of the port.
My goal is to use Clang within a C# program to parse C++ source code and build an AST.
If I understand correctly, I need to get libClang from somewhere as it is a C wrapper around Clang, and then I should be able to use the code in the following link to be able to use libClang from a C# project.
https://github.com/SimonRichards/clang-sharp
My problem is I am lost on how to install Clang. I have download the source from here:
https://github.com/FunkMonkey/libClang
and I tried running the makefiles through the visual studio command prompt but it just gives me an error:
Makefile(14) : fatal error U1034: syntax error : separator missing
Stop.
I'm quite confused as I'm not used to github and makefiles. I think the general process I need to follow is:
Install LLVM - where and what is this?
Install Clang - where is this?
Install libClang - how to run the makefiles?
Use SimonRichard's clang-sharp
I was unable to use the project listed here, however, I was able to get up and running using http://www.nuget.org/packages/ClangSharp
There are plenty of documentation how one can get started to use LLVM / Clang. And all this documentation is pretty explicitly mentioned on the websites:
http://llvm.org/docs/GettingStarted.html
http://llvm.org/docs/CMake.html
http://clang.llvm.org/get_started.html
And bunch of stuff around.