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

Visual Studio Designer issue when target is AnyCPU (63.0.0) #2276

Closed
thicout opened this issue Feb 13, 2018 · 12 comments
Closed

Visual Studio Designer issue when target is AnyCPU (63.0.0) #2276

thicout opened this issue Feb 13, 2018 · 12 comments
Milestone

Comments

@thicout
Copy link

thicout commented Feb 13, 2018

  • What version of the product are you using?
    63.0.0 and 63.0.1 Nuget

  • What architecture x86 or x64?
    AnyCPU

  • On what operating system?
    Windows 7 / Visual Studio 2012

  • Are you using WinForms, WPF or OffScreen?
    WPF

  • What steps will reproduce the problem?

  1. Download, unzip, open demo/anycpu MinimalExample 63.0.0
  2. Build CefSharp.MinimalExample.Wpf (it should succeed)
  3. Restart Visual Studio
  4. Open MainWindow.xaml in Visual Studio Designer
  • What is the expected output?
    Visual Studio Designer should display the MainWindow design (like it was with 57.0.0)

  • What do you see instead?
    The MainWindow design is not displayed in Visual Studio Designer
    Visual Studio Designer shows error: Invalid Markup
    XAML editor shows error: The name "ChromiumWebBrowser" does not exist in the namespace "clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"

  • Please provide any additional information below.
    In my main WPF app, which targets AnyCPU, build / run is working good with 63.0.0. The problem is that I can not work with the Visual Studio Designer / XAML editor (I can't see auto completion, navigate to event handler...). It is working good if I downgrade to 57.0.0.

    When you reproduce the steps above, before step 2 (build), if you check BUILD > Configuration Manager... > Project Plateform combobox, you should see that there is only one AnyCPU item. But after the 63.0.0 installation and restart of Visual Studio, there is two AnyCPU items. You can see my screenshot below.

    Finally, I noticed that with 63.0.0, when targeting AnyCPU, the CefSharp, CefSharp.Core and CefSharp.Wpf References are x64 dll (under Properties > Path). Whereas with 57.0.0 it is x86. This may explain the designer error.

    If I reproduce the steps above, but install 57.0.0 (Package Manager Console => Install-Package CefSharp.Wpf -Version 57.0.0) before step 2 (build), designer work properly.

designer issue 63 0 0 - cefsharp

@amaitland
Copy link
Member

Thanks for the detailed bug report 👍

Have you tested with a newer version of visual studio? I don't immediately see why the x64 libs would be chosen. The duplicate AnyCPU entry is strange, maybe the difference in case causes a problem. AnyCPU vs AnyCpu

@merceyz
Copy link
Member

merceyz commented Feb 14, 2018

I'm able to reproduce using VS 2017, so don't think it's that @amaitland

I'm unable to switch between the two Any CPU entries.
When I removed either of the entries I could see the designer again, though this is because VS sets it to x86 and wont let me change it back

@amaitland
Copy link
Member

If someone has the time to try the 62.0.0-pre01 packages would be helpful. Isolate if the choose when changes made in #2083 are a problem

@thicout
Copy link
Author

thicout commented Feb 14, 2018

Thanks for your answers.
I tested with 62.0.0-pre01 packages, and I had no issue.
designer test anycpu 62 0 0-pre01

@amaitland
Copy link
Member

@thicout Thanks for confirming 👍

amaitland added a commit that referenced this issue Feb 14, 2018
@amaitland
Copy link
Member

I'm hopeful the second AnyCPU target issue is resolved with 4ff892b I've only done minimal testing at this stage.

The defaulting to x64 is a mystery still

@thicout
Copy link
Author

thicout commented Feb 19, 2018

Thanks for your help @amaitland.
I tried your modifications on .props and .targets files. The second AnyCPU target is gone 👍.
But the designer still doesn't seems to work properly on minimal example.
I don't know if it can help, but after a run of my main app (which is working good), the Visual Studio designer shows me this message on a UserControl which doesn't use CefSharp:
Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteException
Could not load file or assembly 'CefSharp, Version=63.0.0.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138' or one of its dependencies. The specified file can not be found.
And then, functions like auto-completion, navigate to event handler, go to definition... cannot be used.

@amaitland
Copy link
Member

One problem down then 👍

I'll look closer at the defaulting to x64 issue when I have time.

Short term you can target x86 for development and just switch to AnyCPU for deployment.

amaitland added a commit that referenced this issue Mar 5, 2018
@amaitland amaitland reopened this Mar 6, 2018
amaitland added a commit that referenced this issue Mar 7, 2018
@amaitland
Copy link
Member

I've had multiple attempts at this and still don't have a solution, appears the <None/> entry is causing the problem,

running msbuild /bl CefSharp.MinimalExample.sln from the command line then analyzing the output using https://github.com/KirillOsenkov/MSBuildStructuredLog shows the correct x86 reference is set. So it appears a bug in Visual Studio. Removing the .targets file from the project (which contains the <None/> entries in the 63.0.1 packages and the correct dll is chosen, at least in my limited testing.

The only solution I can think of currently is to have AnyCPU copy the files manually rather than using the <None/> entry, which is a step backwards in some regards. Changes were initially made to support #2156

amaitland added a commit that referenced this issue Mar 7, 2018
Hopefully this resolves the issue with the VS Designer picking up the x64 ones.

Issue #2276
@amaitland
Copy link
Member

In one final attempt I may have resolved the problem. It appears that VS was entirely ignoring the hint path and referencing the first dll that match, which just so happens to be the x64 ones, I'm now including two <None/> targets, the x86 one being first, and it looks like that is being picked up.

Relevant commit is 837506d

The CI build is https://ci.appveyor.com/project/cefsharp/cefsharp/build/64.0.0-CI2530

With a little more testing I'll make the simplest possible change to the cefsharp/63 branch, just updating the .targets files to copy the files as noted above.

@amaitland amaitland added this to the 63.0.0 milestone Mar 8, 2018
amaitland added a commit that referenced this issue Mar 8, 2018
…perty with both means the x64 are imported first)

It appears that VS is ignoring the HintPath and using the x64 binary even though we tell it to use the x86

This hopefully resolves #2276
@amaitland
Copy link
Member

The 63.0.2 packages have been pushed to Nuget.org, should appear shortly.

The x86 dlls should now be selected by VS when targeting AnyCPU.

@thicout
Copy link
Author

thicout commented Mar 8, 2018

Thank you for your great work. AnyCPU is now working good with 63.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants