How can I add WebView2 control in Visual Studio Toolbar? - visual-studio

In Visual Studio 2019, using Nuget, I have installed Microsoft.Web.WebView2 package.
PM> Install-Package Microsoft.Web.WebView2 -Version 0.9.430
As explained on Web, I have installed new Microsoft Edge Chromium Canary version (it is important).
Now, when I open the Toolbox, I don't see any WebView2 control.
Before that, I have installed WebView control (old version that is working with old Edge browser).
After installing WebView, the control has been visible immediately in Toolbox.
But this is not the case with WebView2 control.
I have tried to add in Toolbox all controls from Microsoft.Web.WebView2 package manually.
But Visual Studio refuses to load WebView2Loader.dll found in following folder
C:\Users\bernard\.nuget\packages\microsoft.web.webview2\0.9.430\build\x86
I have also tried with DLL found in
C:\Users\bernard\.nuget\packages\microsoft.web.webview2\0.9.430\build\x64
Is there possible to install WebView2 control in Toolbox ?
If yes, how ?

I also had this problem. I followed the instructions in the Getting Started tutorial:
https://learn.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/winforms
and installed Canary Edge as well, but the controls were still not appearing. However, it is interesting that the Microsoft.Web.WebView2.WinForms references were not showing up in the References of my Windows Form project initially. They are now appearing, but it is not clear why any of the following steps were necessary after initially simply using Nuget to installing Canary and the latest version of the WebView2 control.
After reinstalling Canary, restart Windows
Clean Project
In Manage Nuget packages, reinstall the WebView2 package to a lower version (I used the prelease of the current version, 0.9.538-prerelease)
After the third step, the library references to the WebView2 control appeared in my project References for the first time, and I was able to use them in the Form Designer.
NOTE: trying to update the control to the release version on 0.9.538 caused the references to disappear from the References and the WebView2 control was no longer available to the Form Designer. Reinstalling the prerelease solved the issue, so it appears the release of 0.9.538 supports a smaller scope than its prerelease.
TL;DR: do not update to the latest version of 0.9.538, just use the 0.9.538-prerelease.

You need to make sure that you select the checkbox "include prerelease" next to the text box for searching for packages by name. Then select a version which has a prerelease label.

Even after using the prerelease version, it was not showing in my toolbox in Visual Studio 2017 Community edition 16.6.6
My solution was to do the following:
Right-click on the toolbar in Visual Studios
Select 'Choose Items...'
Click the '.NET Framework Components' tab
Click 'Browse', may have to wait for scan to finish
Navigate to '\packages\Microsoft.Web.WebView2.0.9.538-prerelease\lib\net462'
Select the correct DLL for your application type
Once the file is selected click the 'OK' button in the window
Solution copied from here:
https://developercommunity.visualstudio.com/content/problem/1112781/webview2-control-is-missing-from-toolbox.html

EDIT: According to this post you need to use Canary or Dev build of Edge or the Edge WebView2 Preview no matter what version is supposed to work according to the release notes.
The main reason people have this problem is because they have not installed the required version of Edge.
Check the release notes. For each release you see the "minimum Microsoft Edge version". For example, when you install the latest WebView2 release 0.9.579 (released 07/20/2020) it requires Edge 86.0.579.0
but the official Edge build is (on that day) 84.0.522.
So the answer is:
either update Edge to a newer version
or use an older version of Microsoft.Web.WebView2. For which you likely need to enable prereleases:
Important: Do not downgrade! Uninstall WebView2 Nuget package, restart VS, install an older version of it, to be on the safe side.

You can now do this in C#. Just tested in WinForms.
https://learn.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/winforms
You must also download the Canary version of the browser from here: https://www.microsoftedgeinsider.com/en-us/download

I initially installed version 0.9.579 assuming that the pre-release components from 0.9.538 would be included in the newer version - no such luck. It appears that the components are only in the prerelease versions at the moment - I installed 0.9.579-pre-release and got the webview2 in the toolbox

Is there possible to install WebView2 control in Toolbox ?
I am afraid that you can't get the results you want at this stage.
As this link shows that webview2 cannot support c# projects and only support C++ projects . And Microsoft will apply it on .Net projects in the future.
Also, when you find this package on NuGet Package Manager UI, you find that it is related to C++.
I hope it won't be long before I can use it on net projects.

Just tried this with webView2 v1.0.721-prerelease and it is working
After making a new winforms project and installing the webview2 nuget package, I did have to do a rebuild solution build before it showed in the toolbox

Related

"Project->Project Options" is disabled/greyed out in Xamarin

I'm on Xamarin Studio 6.0.2 (Build 73), running on Windows. Even when I create a fresh new project, the Project Options menu entry is disabled, which means I have to edit the .csproj file in Notepad++, which is not very convenient.
Some other menu entries are also greyed out. As I said, this happens even for New projects created by Xamarin Studio.
So having looked at your version information it seems like Xamarin.Android is not installed which is why you are having this issue.
You will need to install the Xamarin.VisualStudio package. Even if you only intend to use Xamarin Studio, this is required as it includes both Xamarin.Android and Xamarin.iOS.
Please reach out to contact#xamarin.com and we can provide you with the link for this! Please add the link to this question in your email.

VS2015 Extension Manager not reporting update for MSI-intalled extension

I've written a Visual Studio extension which installs using an MSI. The install puts a extension.vsixmanifest file in the right place, and the extension appears in the Extension Manager as expected:
The problem is, when I publish a new version on the Visual Studio Gallery, the Extension Manager does not report it. I add the new version by creating a new installer and editing the existing page. Each new installer has a new ProductCode, PackageCode and ProductVersion (I update the MSI setup project and the version number in the included extension.vsixmanifest), but the same UpgradeCode; an example 'upgrade' commit can be found on GitHub here.
The issue appears to be that when Visual Studio Extension Manager queries the extensions service for the latest version of my extension, it returns a blank string - the same result as if you query with an invalid extension identifier:
The two extensions successfully queried in the example are the NuGet client tools for VS2015 and the SQL Server Compact/SQLite Toolbox.
What am I missing?
OhhhhhhKAY. I've solved this, and it turned out to be a problem with the Visual Studio Gallery page editor.
When you add an extension, you're shown a VSIX ID box:
When you edit an extension (I'm using Chrome), that box has disappeared!
It's still in the DOM, but it's hidden from view. Because of this, I never entered my extension's VSIX ID into the form, it didn't have a value associated with it, and the extensions service therefore didn't return a version number for that ID. The Extension Manager uses the extensions service to find out the latest versions of installed extensions, so it wasn't reporting new versions of mine.
The VSIX ID box reappears if you deselect then reselect one of the extension's supported Visual Studio versions, so I've been able to assign the ID that way. The service now returns a version number, and the Extension Manager therefore shows available updates:
Probably you may need to raise ProductVersion as well and mind correct version conditions in Upgrade Table in installer project. If this will not help try investigating this issue installing with full verbose log (msiexec /i installer.msi /l*v logfile.log) this may give some clues. The worst case you may want to add an entry to RemoveFiles table to delete this file (during install before deploying your file) but that sounds nasty and i would prefer to avoid it.
I don't think this is a problem with your installer configuration, assuming your installer does, in fact, upgrade your product. If I understand your question correctly, this is an issue with Extension Manager.
Have you tried removing the trailing .0 from your new version string? There might be an poor/unexpected comparison result when comparing a 3-dot version to a 4-dot version.
You could also try doing a more extreme version number change (upping the major version) to see if Extension Manager picks that up.

How to update Xamarin.Forms to latest version?

I'm starting to work with Xamarin.Forms for the first time. I noticed I might have an outdated version in my project though, and I can't find how to update it.
Looking at the NuGet gallery, the latest version is 1.5:
https://www.nuget.org/packages/Xamarin.Forms/
However, in my project, I'm still using version 1.3 somehow, even though I created the project only a few days ago. Here's what the solution explorer looks like:
Xamarin Studio won't let me update the references because they are "from packages". What does that mean and how can I update?
From menu click Project->Update Nuget Packages then it will check updates(can be check from status bar at top side of editor). When it finished the update checking process go to Packages from solution explorer. You'll see the (1 update notification). Right click the package and update.
It's that simple.
You can find Xamarin.Forms as a NuGet package, so you have to go under Package, not Reference, and Add Package
As for August 2019, you can go to your Forms project in Solution window, open Dependencies > NuGet and right click on Xamarin.Forms and then click Update if you want to only update Xamarin.Forms. Remember about doing it for 3 projects: *.Forms, *.Forms.Android and *.Forms.iOS.
Project->Update Nuget Packages will update everything which is not always desired

Visual Studio: How to automatically uninstall previous installed version?

I have a simple Web Setup project that reads from a Deployable Project.
Even though I have set the Setup to DetectNewerInstalledVersion to false I always get that annoying alert box that a previous installation exists and I need to go to the Control Panel and find the software to remove it...
Is there a way to add a script in a new new installation Dialog that could say A previous version was found, press NEXT to uninstall it. ?
Older versions are uninstalled automatically if you increase your Product Version and change the Package Code. This needs to be done each time you modify the setup project and build a new package.
If you keep the same version and Product Code, older builds cannot be uninstalled automatically. They are detected by Windows Installer before your new package is actually launched. So you need to uninstall them manually.
In my case I found out that the setup project wasn't part of the configuration manager.
Therefore, it wasn't rebuld on solution rebuilds and setup file with the new version and ProductCode wasn't generated.
The solution is simply to right click on the setup project and click rebuild.
Hope this help to future readers :)
The answer is not to use the Visual Studio setup project that's already integrated. I'm having the exact same problem: it won't remove previous versions even though I up the version, set it to remove previous version, check for previous version and rebuild, I can install but the files aren't updated. There are some good tools for this out there, check out bitrock, inno setup or wix.
Also Visual Studio 2010 was the last version with setup project support. It's not included in 2012.
I struggled with this for a long time but it is very simple.
Go to manage VS Extensions (VS2019) and install 'Microsoft Visual Studio Installer Project' v0.9.9
Right click on your installer project and go to properties. Keep the UpgradeCode variable in the properties window the same for different versions of the same product.
Change your ProductCode variable between different builds.
Now when you install the product with the same UpgradeCode already on the system, the installer will upgrade your existing product and you will only have one program in the Add/Remove window.
Create a .bat file
Write this code:
wmic product where name="SetupProgramName" call uninstall /nointeractive
cd Debug
setup.exe
Put this file in installer directory.

How to manually uninstall a Visual Studio 2010 extension?

So I got prompted to download the latest NuGet Package Manager in VS2010.
All previous updates (including this) has failed with:
VSIXInstaller.SignatureMismatchException: The installed version of 'NuGet Package Manager' is signed, but the update version has an invalid signature. Therefore, Extension Manager cannot install the update.
Which, in itself has been going on for some time now, and they still haven't fixed it (look in Q&A).
Ok, fine, previously I could simply uninstall the NuGet extension and install the latest. However, this time, both the Disable and Uninstall buttons are disabled.
So I can't uninstall and I can't upgrade.
Catch22.
How can I manually remove the NuGet extension from Visual Studio?
What files/folders/reg entries do I have to kill to get rid of NuGet?
To uninstall NuGet, you must first run Visual Studio as Administrator, then you will see the Uninstall option available.
Restart VS, but this time run it as your normal account. When you install NuGet going forward, you should be able to update to future versions without running as Administrator.
I believe this issue occurs due to NuGet being installed with MVC 3. I hope in the future we no longer bundle NuGet with other software.
Maybe this is fixed now. There is a very new release.
http://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c/
http://docs.nuget.org/docs/reference/known-issues#Upgrading_to_latest_NuGet_from_an_older_version_causes_a_signature_verification_error.
When viewing the logs, you might see a mention of a SignatureMismatchException.
To prevent this from occurring, there is a Visual Studio 2010 SP1 hotfix you can install. Alternatively, the workaround is to simply uninstall NuGet and then install it from the VS Extension Gallery. See http://support.microsoft.com/kb/2581019 for more information.
If you want to delete/uninstall Nuget package which is applied to multiple projects in your solutions then go to:
Tools-> Nuget Package Manager -> Manage Nuget Packages for Solution
In the left column where is 'Installed packages' select 'All', so you'll
see a list of installed packages and Manage button across them.
Select Manage button and you'll get a pop out, deselect the checkbox across project name and Ok it
The rest of the work Package Manager will do it for you.

Resources