adammarks / netcoreproto

.NET Core C++/CLI Prototypes
0 stars 0 forks source link

NativeInteropApp-WPF-Multi Compile Error in C++/CLI when using WPF #6

Open adammarks opened 4 years ago

adammarks commented 4 years ago

This is the first time I'm trying to use something from WPF in a C++/CLI assembly and I get the following compile error

error C3624: 'System::Windows::DependencyObject': use of this type requires a reference to assembly 'WindowsBase'

Repro Steps

  1. pull down the repo
  2. Open NativeInteropApp-WPF-Multi\NativeInteropApp-WPF-Multi.sln
  3. Set to Debug / x64 - Startup project as NativeinteropApp
  4. Rebuild All

Results:

error C3624: 'System::Windows::DependencyObject': use of this type requires a reference to assembly 'WindowsBase'

Expected:
I have a Framework Reference to Microsoft.WindowsDesktop.App.WPF so that should be enough to get WindowsBase I think?

mjrousos commented 4 years ago

This looks like a bug to me.

@nguerrera, can you please take a look? Using a WPF window (System.Windows.Window) in a C++/CLI library is failing to build, even with <FrameworkReference Include="Microsoft.WindowsDesktop.App.WPF" /> or <FrameworkReference Include="Microsoft.WindowsDesktop.App" />.

To repro, use the NativeInteropApp-WPF-Multi solution from this repo and notice that building the CPP_CLI_Interop project fails with the error @adammarks pasted above.

nguerrera commented 4 years ago

This looks like the same issue as https://github.com/dotnet/sdk/issues/4204, which we'll be investigating now. cc @wli3

wli3 commented 4 years ago

The fixed is checked in. Please reference https://github.com/dotnet/sdk/pull/4245 for workaround

adammarks commented 4 years ago

Thanks @wli3 @mjrousos @nguerrera The workaround does fix this issue.

adammarks commented 4 years ago

I'll leave this open so I can retest when 16.5 is ready

mjrousos commented 4 years ago

@adammarks, I just tried this scenario out again with the latest preview (16.6 preview 3) and confirmed the solution builds and runs successfully without the workaround.