GithubHelp home page GithubHelp logo

Comments (2)

jchv avatar jchv commented on August 10, 2024 1

The NuGet WebView2 package contains the latest WebView2Loader.dll.

  1. Download NuGet package file from https://www.nuget.org/packages/Microsoft.Web.WebView2/

  2. Either rename file extension from .nupkg to .zip or open using 7-Zip using Open With.

  3. Go to "runtimes" folder, then pick a folder depending on which architecture you want, and under that go to the "native" folder. There should be a file named WebView2Loader.dll.

from go-webview2.

CarsonSlovoka avatar CarsonSlovoka commented on August 10, 2024

from Release Notes for the WebView2 SDK

You can get the version: NuGet package for WebView2 SDK
image

and then you will navigate to the download page as below once you click

image
click Download package to get the file...

Get it from script

here is an example help you quickly get the target you want.

package main

import (
	"archive/zip"
	"fmt"
	"io"
	"log"
	"net/http"
	"os"
	"path/filepath"
)

func main() {
	const zipPath = "webview.zip"
	const downloadURL = "https://globalcdn.nuget.org/packages/microsoft.web.webview2.1.0.1661.34.nupkg"
	if err := download(downloadURL, zipPath); err != nil {
		log.Fatal(err)
	}

	const unZipPath = "./tempWebview"
	if err := UnZip(zipPath, unZipPath); err != nil {
		log.Fatal(err)
	}
}

func download(src, dst string) error {
	log.Printf("download from %q to %q", src, dst)
	resp, err := http.Get(src)
	if err != nil {
		return err
	}

	f, err := os.Create(dst)
	if err != nil {
		return err
	}
	defer func() {
		_ = f.Close()
	}()
	contents, err := io.ReadAll(resp.Body)
	if err != nil {
		return err
	}
	if _, err = f.Write(contents); err != nil {
		return err
	}
	return nil
}

func UnZip(zipPath, dstDirPath string) error {
	// open zip
	r, err := zip.OpenReader(zipPath)
	if err != nil {
		log.Fatal(err)
	}
	defer func() {
		_ = r.Close()
	}()

	var (
		dst *os.File
		src io.ReadCloser
	)

	for _, zipFile := range r.File {
		if zipFile.FileInfo().IsDir() {
			if err = os.MkdirAll(filepath.Join(dstDirPath, zipFile.Name), os.ModePerm); err != nil {
				log.Fatal(err)
			}
			continue
		}

		// prepare: dst
		dstFilePath := filepath.Join(dstDirPath, zipFile.Name)
		dst, err = os.Create(dstFilePath)
		if err != nil {
			log.Fatal(err)
		}

		// prepare: src
		src, err = zipFile.Open()
		if err != nil {
			return err
		}

		// copy from src to dst
		_, err = io.Copy(dst, src)
		if err != nil {
			return err
		}
		_ = dst.Close()
		_ = src.Close()

		if filepath.Base(zipFile.Name) == "WebView2Loader.dll" {
			absDstFilePath, _ := filepath.Abs(dstFilePath)
			fmt.Println(absDstFilePath)
		}
	}
	return nil
}

output

build/native/arm64/WebView2Loader.dll
build/native/x64/WebView2Loader.dll
build/native/x86/WebView2Loader.dll
runtimes/win-arm64/native/WebView2Loader.dll
runtimes/win-x64/native/WebView2Loader.dll
runtimes/win-x86/native/WebView2Loader.dll

from go-webview2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.