How can my C# Windows Runtime Component install the WebView2 Runtime? - c#

Pretty simple question. I know how to find out if it's been installed. But, if it hasn't....how do I install it? All of the documentation appears to be geared towards C++ where you can just run Shell commands. I also found something where you can use a FullTrustProcessLauncher but you have to modify the package manifest to get permission and, since this is a component, I can't do that.

Related

Windows App Certification Kit - Security Features error

I am working on a UWP app and I have come across a strange issue with windows app certification kit (WACK).
The app itself runs fine but when I test the app through the WACK it always fails the certification saying that /SomePackagePath/sni.dll failed AppContainerCheck. Also, the supported APIs test shows a long list of unsupported APIs that my app doesn't use but WACK thinks it does. I have no idea why does it do that.
I have created numerous packages and tried to fix code-behind where I thought things could be wrong but to no avail. I tried to search the error on internet and I found out that my app should enable the .Net native tool chain and I checked the project settings and it is already enabled.
The WACK also says something about some linker options that should be set but I have no idea how to set those linker options in VS 2017. I am using the latest VS 2017 with all updates. Any suggestions on what to do? Any help will be greatly appreciated.
I can provide further information if anyone needs it.
The WACK report has said clearly. The "sni.dll" called some APIs which are not supported in UWP. If the "sni.dll" was made by you, I suggested that you'd better check its source code. You could check .NET for UWP apps document to see if this dll calls some unsupported APIs. If this DLL isn't made by you, you could first remove it from your project and create a package to see if it will be able to pass the WACK. Then, you will know if this issue was due to this DLL.
Beside, you could debug your code to see if you will get some exception when enable the "Compile with .NET Native Tool chain" and "Optimize code".
I managed to find the culprit and it was related to Jint nuget package. Apparently it uses some APIs which are not allowed in the UWP system and that also sni.dll is part of this.

Windows UWP - Modify AppX Package At Runtime

We need to dynamically load assemblies at runtime in order to include customization for our users. However, after looking all over the web, I cannot find any information on whether Microsoft plan to make this feature possible or not. I have started a feature request here:
https://wpdev.uservoice.com/forums/110705-universal-windows-platform/suggestions/18145291-dynamically-load-assembly
Failing that, I figured that it may be possible to manually add assemblies in to the AppX package, and then force the user to quit, and reopen the app. Yes, this is horrible, but I don't see any way around this currently. Are there any examples out there on how to modify the AppX package?
Or, is this idea thwarted because the package would lose its certificate signing?

Couldn't find the required information in the lock file. Make sure you have .NETCore,Version=v5.0/win10-anycpu mentioned in your targets

I'm working on a Windows 10 universal app. The aim was to have a JS front end connecting to a C# library for the heavy lifting. Though when I add the reference and trey to compile I get the following error
Couldn't find the required information in the lock file. Make sure you
have .NETCore,Version=v5.0/win10-anycpu mentioned in your targets.
I've looked around and in a few cases the solution has been to update Visual Studio and the NuGet packages which I have done.
Any suggestions would be great,
Thanks
Just change build configuration to x86 or ARM and it should work.
Any CPU is not supported by UWP projects, because they are built using .NET Native. You can read more about it here.

How do I know which prerequisites my application needs?

So I wrote an application and created an installer. When I tried to install it on other machines, the app simply wouldn't work. After messing around with it for a while, it seemed like I needed to select visual C++ Runtime Libraries as a prerequisite. Now I'm wondering if I may need other prereqs. How on earth do I know what are all the prereqs an app will need?

Getting GTK# app to run on windows

I am unable to get a GTK# app to run on windows, and I would appreciate any help I can get. I tried googleing around, but was unable to find a solution for my problem.
I wrote a small app in monodevelop using GTK#, which just opens a window with a button.
It runs fine on linux.
However I am unable to get it to run on windows.
I tried installing the GTK+ and the GTK# redistributables, the GTK# SDK, but it still does not work. And it does not show any exceptions thrown (in the command line), which would be helpful for debugging the problem.
After invoking the .exe, it sits there for a few seconds, and after that the shell reappears waiting for the next command, no output whatsoever.
Can anyone please walk me through what do I have to install on a virgin windows install to be able to run GTK# applications?
[edit] I understand mono is not needed to run them, and would like to avoid it, if possible.
Mono.Posix is a required part of the GTK# system - it contains the gettext library interface used to handle internationalized text. By writing in MonoDevelop, there is an option to allow internationalized text when creating the GUI interfaces, which will automatically call this library as part of the generated Build function (it seems to be called when setting user-displayed text, like the title of your form). This means you only need the Mono.Posix.dll library (which will work on Microsoft .NET), not the full Mono runtime.
The exception may be getting written to stderr instead of stdout, which the Windows command line does not show by default. Try:
myapp.exe 2> my.log
and see if that writes the error to a logfile called my.log.
Much like you I had an issue running on Windows 10. The issue in my case was resolved after another Google Result to a blog which mentions that the Mono.Posix references are indeed the cause. However, the blog indicated that you must also delete/convert global::Mono.Unix.Catalog.GetString (if you are using MonoDevelop's Stetic GUI creator). Those will be usually on your Labels.
ie:
dev#laptop:/tmp/myproject$ rg "global::Mono.Unix."
96: this.label2.LabelProp = global::Mono.Unix.Catalog.GetString("25 ROUNDS OF DEAF");
changes to
96: this.label2.LabelProp = "25 ROUNDS OF DEAF"
Since Stetic GUI creator usually puts Partial class files in the subfolder gtk-gui of the project directory. That's probably the best place to check for strays. Although ripgrep (the rg command used up there does recursive fast directory searching of all child folders so might as well use that)
After this you must install the GTKSharp Runtime for .NET (as of today it's file gtk-sharp-2.12.45.msi from mono-project.com for GTK+ also known as GTK2. GTK3 is different and it may be different for future Googler's)
After that recompile the application in MonoDevelop and you can run it on Windows
Source of steps: https://www.martyndavis.com/?p=432
Actually application can run without Mono (console apps, for example) on Windows, but if you have reference to Mono.Posix in code, it can use some platform-specific functions that couldn't be executed on Windows.
On Windows in MonoDevelop you can choose between frameworks (Mono or MS.Net). Try to recompile app on Win with MS.Net framework selected.

Categories

Resources