Error while adding "WebView 6.0.0" to project - c#

I use WebView 5.1.1 (EdgeHTML) in my WPF project on .NET Framework 4.6.2. When I update to version 6.0.0, I get a error
Must use packagereference.
It happens to the Microsoft.Windows.Sdk.Contracts library, which appears when version 6.0.0 is installed.
How do I fix this?
And then there's the question.
When will WebView 2 (Chromium) be released on .NET C# WinForms or WPF?
Will there be differences from WebView (EdgeHTML)?

Related

.Net Maui LongPress

I have a page that contains a CollectionView of images. I want the user to be able to LongPress on an image and then they will have the option to delete or edit the image.
I'm trying to implement LongPress functionality in my .Net Maui project, however I can't find any documentation for this. How do you guys handle LongPress? Am I missing something?
Due to the TouchEffect has not yet been ported from Xamarin Community Toolkit to Maui Community Toolkit, you can add the Xamarin.CommunityToolkit.MauiCompat 2.0.2-preview1013 to your project. It is the .NET MAUI Compatible version of Xamarin.CommunityToolkit.
Here is the codes you can directly run in the package manager console to add this package:
NuGet\Install-Package Xamarin.CommunityToolkit.MauiCompat -Version 2.0.2-preview1013

Error adding ChromiumWebBrowser to project - C# Visual Studio

I am trying to add the Cef.WinForms library to my project and I'm following the steps found here
https://tutorialslink.com/Articles/DEVELOPING-CHROMIUM-BASED-BROWSER-IN-Csharp/1468. I was able to add the library find using Nuget, however I did get a warning that it expected .NET 4.6.1 and I have .NET 5.0. I tried to manually install 4.6.1 but it will not allow it as it says a newer version is already installed. This may not even be the cause of my error but I wanted to mention it just in case.
When I try to drag the component ChromiumWebBrowser over to my main form, I get the error seen below. I've searched for this error to try and resolve it but I am so far not finding anything helpful. Does anyone know what I'm missing here?
As noted in the comments, when targeting .Net 5.0 you'll need to use the packages with the NETCore suffix.
For .Net Core 3.1/.Net 5.0+
https://www.nuget.org/packages/CefSharp.WinForms.NETCore/
https://www.nuget.org/packages/CefSharp.Wpf.NETCore/
https://www.nuget.org/packages/CefSharp.OffScreen.NETCore/
NOTE A minimum of .Net Core 3.1 is required.
For the .Net 4.5.2 to .Net 4.8
https://www.nuget.org/packages/CefSharp.WinForms/
https://www.nuget.org/packages/CefSharp.Wpf/
https://www.nuget.org/packages/CefSharp.OffScreen/
All packages require Microsoft Visual C++ 2019 or greater.
Ijwhost.dll
To support C++/CLI libraries in .NET Core/.Net 5+, ijwhost was created by Microsoft as a shim for finding and loading the runtime. All C++/CLI libraries are linked to this shim, such that ijwhost.dll is found/loaded when the C++/CLI library is loaded. It's important this dll is distributed with your application.

How to fix TargetPlatformMinVersion problem in WPF app?

I'm trying to use Windows UI library in my WPF app, and whenever I install Microsoft.UI.Xaml I get the following error.
Microsoft.UI.Xaml nuget package requires TargetPlatformMinVersion >= 10.0.15063.0 (current project is -1)
How to resolve this issue?
My windows SDK version is the latest version downloaded from here.
My OS version is 20H2 and the build number is 19042.685
I tried changing the targeted framework from .NET Core 3, 3.1, and .NET 5.
[If you think the title of this question is not appropriate, feel free to suggest an edit.]
I had the same problem transferring my project from .NET Framework 4.8 to .NET 6 (needed to have "using declarations").
Here's how I fixed mine:
Go to the affected project's settings.
Go to General and Target OS version.
Choose 1.0.19041.0 (or at the very least it must be 10.0.18362.0)
In the Supported OS version, choose any version except 7.0 or 8.0.
Build the project.
I think (I'm not sure) the issue here is UI.Xaml doesn't support Win 7 or Win 8.

Reference to type 'Assembly' claims it is defined in 'System.Runtime', but it could not be found

Since updating to VS2017 15.7.1 my Xamarin PCL project is showing the error below in the UWP App.xaml.cs file.
Error CS7069 Reference to type 'Assembly' claims it is defined in 'System.Runtime', but it could not be found
The offending line is copied below. IntelliSense works on the line.
Xamarin.Forms.Forms.Init(e);
There are also now a lot of conflict warning messages, for example;
Warning Found conflicts between different versions of "System.Net.Http" that could not be resolved.
The target .NET framework is 4.5, all NuGet libraries are up to date.
So far I've tried adding System.Runtime as a reference and re-installed all NuGet libraries to get rid of the error without success.
I'm still finding my way around Xamarin, any guidance to fix this would be appreciated.
Thanks,
Lefty
This happened to me recently. It was from creating an Xamarin application with PCL and changing the target from .NET standard 2.0 to .NET Standard 1.4. After downgrading the Xamarin.Forms from version 3.0.0.446417 to version 2.5.1.527436 in all the projects, it compiled without errors.
Explanation (per request):
If you are Targeting before Fall Creators Update (version 6.332), you will need to remove all references to .NET Standard 2.0.
Xamarin Forms 3.x uses .NET standard 2.0. Since you are targeting below Fall Creators Update (version 6.332) the PCL will need to be .NET Standard 1.x.
More information here.
I had the same problem with Xamarin Forms 3.0.0.446417 being installed. I just went back to the previous version, 2.5.1.527436, but then my Android project fails with "The target "CssG" does not exist in the project."
It appears to be a problem with that version of Xamarin Forms.

The C# Project is targeting ".NetFramework, Version=v4.5,Profile=Unity Full v3.5", which is not instaled on this machine

I tried to open a script in VS2015 from Unity 5.6.
For some reasons, this popup shows up and I click the first option and change the target to .Net Framework 4.5.2 and everything builds and works as expected.
However, every time I made changes in the Unity editor and switched back to Visual Studio, this dialog pops up again.
When I looked into the csproj files, I can see that, after I made changes in the Unity editor, I see this:
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Unity Full v3.5</TargetFrameworkProfile>
Then after I selected "Change the target to .NET Framework 4.5.2"
I see this:
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
It seems that the Unity editor is configured to change the .Net Framework to 4.5.
I tried to install .Net Framework 4.5 but it is already installed.
Is there any way I can either use .Net 4.5 in Visual Studio or change the target framework in Unity such that this dialog won't pop up again?
Before you do anything complicated, try this:
Open Edit>Project Setting>Player
Click Other Setting, go to Configuration, if the scripting runtime version is .NET 3.5, change it to .NET 4.x.
This not only fixed the warning, it also got back VS intellisense and the MathNet.Numerics can now be installed properly.
If this does not work, then try this link project-target-framework-not-installed.
In the Unity roadmap is stated that support for .net 4.6 will be added arround july 2017. The beta is out allready.
Scripting Runtime Upgrade (Preview)
Upgrade Mono and IL2CPP .NET runtimes to support the latest .NET functionality and APIs. This includes access to C# 6 and the .NET 4.6.x class library profile.
Currently Unity is only compatible with .net 3.5 but here is an workaround which may help.
If you have any of the .NET Framework v4.6 series allready installed you only need to install the Visual Studio 2015 Tools for Unity to be able to use the project without conversions.

Categories