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

Migrating C++/CLI project throws compiler warning C4945 #31123

Open
NavrimCPP opened this issue Mar 10, 2023 · 3 comments
Open

Migrating C++/CLI project throws compiler warning C4945 #31123

NavrimCPP opened this issue Mar 10, 2023 · 3 comments
Labels
Area-NetSDK untriaged Request triage from a team member
Milestone

Comments

@NavrimCPP
Copy link

The Solution contains a combination of C#, C++/CLI and C++ projects.
I followed the guide for migrating C++/CLI projects.(https://learn.microsoft.com/en-us/dotnet/core/porting/cpp-cli.)

I need to specify the FrameworkReference for WPF (<FrameworkReferenceInclude="Microsoft.WindowsDesktop.App.WPF" />).

When compiling, I get many C4945 warnings. Because we have TreatWarningsAsErrors enabled, the project can't be compiled. Disabling TreatWarningsAsErrors or disabling the C4945 warnings is not a permanent solution for us.

Example C4945 warning:
warning C4945: 'BulletChrome': cannot import symbol from 'C:\Program
Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\6.0.14\ref\net6.0\PresentationFramework.Aero2.dll': as 'Microsoft::Windows::Themes::BulletChrome' has already been imported from another assembly 'PresentationFramework.Aero'

The warnings can be easily reproduced

  • Create a new C++/CLI(.NET) Project

  • Add the following to the .vcxproj file

    <ItemGroup>
        <FrameworkReference Include="Microsoft.WindowsDesktop.App.Wpf" />
    </ItemGroup>
  • And Compile

What can I do to stop these warnings from occurring?

Previously, I was able to reference explicitly, e.g.

<ItemGroup>
    <Reference Include="PresentationCore" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xaml" />
    <Reference Include="WindowsBase" />
</ItemGroup>
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Mar 10, 2023
@marcpopMSFT
Copy link
Member

@jaredpar any pointers on those compiler warnings in a c++/CLI app?

@marcpopMSFT marcpopMSFT added this to the Discussion milestone Mar 14, 2023
@jaredpar
Copy link
Member

@dangrif have any pointers here?

@NavrimCPP
Copy link
Author

Hi, is there any new information about the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

3 participants