Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebView2Loader.dll is not copied to correct output directory with C++ MFC project #851

Closed
jhandley opened this issue Jan 25, 2021 · 2 comments
Labels
bug Something isn't working tracked We are tracking this work internally.

Comments

@jhandley
Copy link

jhandley commented Jan 25, 2021

Description
WebView2Loader.dll is copied into Debug\x86\ and Debug\x64\ even when the output directory of the project is just set to Debug without the platform. In earlier versions WebView2Loader was copied into the output directory (Debug) correctly.

Between this and #506 we are not able to upgrade from version 1.0.622.22 which was the last version that worked for MFC projects.

Version
SDK: 1.0.721-prerelease
Runtime: 88.0.705.50
Framework: MFC
OS: Win10
Microsoft Visual Studio Community 2019 Version 16.8.3

Repro Steps

  1. Create new MFC project in Visual Studio (I just accepted all defaults)
  2. Add Microsoft.Web.WebView2 and Microsoft.Windows.ImplementationLibrary packages from Nuget
  3. Add code to create web view somewhere (e.g. OnCreate() of CMainFrame)
  4. Run

You get an error that WebView2Loader.dll cannot be found.

Looking at the filesystem the executable (MFCApplication2exe) is in MFCApplication2/Debug but WebView2Loader.dll is in MFCApplication2\Debug\x86.

Seems like the either the build files should copy WebView2.dll to the output directory without the platform (x86...) or when running the dll search path should include the path with the platform.

Here is a snippet of MSBuild log (verbose) for setting target path for WebView2Loader.dll:

1>Target "AssignTargetPaths" in file "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets":
1>  Using "AssignTargetPath" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>  Task "AssignTargetPath"
1>    Task Parameter:RootFolder=C:\Users\josh\source\repos\MFCApplication2\MFCApplication2
1>  Done executing task "AssignTargetPath".
1>  Task "AssignTargetPath"
1>    Task Parameter:RootFolder=C:\Users\josh\source\repos\MFCApplication2\MFCApplication2
1>    Task Parameter:
1>        Files=
1>            C:\Users\josh\source\repos\MFCApplication2\packages\Microsoft.Web.WebView2.1.0.721-prerelease\build\\..\runtimes\win-x86\native\WebView2Loader.dll
1>                    CopyToOutputDirectory=PreserveNewest
1>                    IncludeInVsix=true
1>                    Link=x86\WebView2Loader.dll
1>                    PublishState=Included
1>                    Visible=False
1>            C:\Users\josh\source\repos\MFCApplication2\packages\Microsoft.Web.WebView2.1.0.721-prerelease\build\\..\runtimes\win-x64\native\WebView2Loader.dll
1>                    CopyToOutputDirectory=PreserveNewest
1>                    IncludeInVsix=true
1>                    Link=x64\WebView2Loader.dll
1>                    PublishState=Included
1>                    Visible=False
1>            C:\Users\josh\source\repos\MFCApplication2\packages\Microsoft.Web.WebView2.1.0.721-prerelease\build\\..\runtimes\win-arm\native\WebView2Loader.dll
1>                    CopyToOutputDirectory=PreserveNewest
1>                    IncludeInVsix=true
1>                    Link=arm64\WebView2Loader.dll
1>                    PublishState=Included
1>                    Visible=False
1>    Output Item(s): 
1>        ContentWithTargetPath=
1>            C:\Users\josh\source\repos\MFCApplication2\packages\Microsoft.Web.WebView2.1.0.721-prerelease\build\\..\runtimes\win-x86\native\WebView2Loader.dll
1>                    CopyToOutputDirectory=PreserveNewest
1>                    IncludeInVsix=true
1>                    Link=x86\WebView2Loader.dll
1>                    OriginalItemSpec=C:\Users\josh\source\repos\MFCApplication2\packages\Microsoft.Web.WebView2.1.0.721-prerelease\build\\..\runtimes\win-x86\native\WebView2Loader.dll
1>                    PublishState=Included
1>                    TargetPath=x86\WebView2Loader.dll
1>                    Visible=False
1>            C:\Users\josh\source\repos\MFCApplication2\packages\Microsoft.Web.WebView2.1.0.721-prerelease\build\\..\runtimes\win-x64\native\WebView2Loader.dll
1>                    CopyToOutputDirectory=PreserveNewest
1>                    IncludeInVsix=true
1>                    Link=x64\WebView2Loader.dll
1>                    OriginalItemSpec=C:\Users\josh\source\repos\MFCApplication2\packages\Microsoft.Web.WebView2.1.0.721-prerelease\build\\..\runtimes\win-x64\native\WebView2Loader.dll
1>                    PublishState=Included
1>                    TargetPath=x64\WebView2Loader.dll
1>                    Visible=False
1>            C:\Users\josh\source\repos\MFCApplication2\packages\Microsoft.Web.WebView2.1.0.721-prerelease\build\\..\runtimes\win-arm\native\WebView2Loader.dll
1>                    CopyToOutputDirectory=PreserveNewest
1>                    IncludeInVsix=true
1>                    Link=arm64\WebView2Loader.dll
1>                    OriginalItemSpec=C:\Users\josh\source\repos\MFCApplication2\packages\Microsoft.Web.WebView2.1.0.721-prerelease\build\\..\runtimes\win-arm\native\WebView2Loader.dll
1>                    PublishState=Included
1>                    TargetPath=arm64\WebView2Loader.dll
1>                    Visible=False
1>  Done executing task "AssignTargetPath".
1>  Task "AssignTargetPath"

AB#31499850

@jhandley jhandley added the bug Something isn't working label Jan 25, 2021
@champnic champnic added the tracked We are tracking this work internally. label Jan 28, 2021
@champnic
Copy link
Member

Thanks for this report - I've opened a bug on our backlog. Hopefully the fix for #506 just fixes this behavior as well.

@champnic
Copy link
Member

This should be fixed in 1.0.824-prerelease SDK package. Please give it a try and let us know if you run into any further issues. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

2 participants