dotnet / dotnet/sdk

Can't make a C++ app with C++/CLI dependency self contained

Open
#44,305 0 comments 0 reactions 1 assignee Claimed by @baronfel View on GitHub
Area-NetSDK untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

I am using a Windows App Packaging Project to package a C++ MFC app that references a C++/CLI MFC dll extension project. The WAP project is used to create an MSIX package that can be side-loaded and eventually will be used to upload to the Microsoft Store. The issue I am running into is that the packaged app will crash when calling .NET code from the MFC extension dll if the .NET 8 Runtime is not installed. All I get from the event viewer is

`Faulting module name: ucrtbase.dll, version: 10.0.26100.1882, time stamp: 0xf79ede89`

Since the WAP project is referencing a C++ project, it adds the Microsoft VCLibs Desktop dependency, meaning the packaged app has the required MFC dlls to run self contained. When I build a WAP project that references a .NET project as it’s entry point, it adds all the necessary dll’s to make it self contained and not require the .NET runtime to be installed.

I have tried making the C++/CLI project self contained, and have tried adding a self contained C# project to the solution just to get the .NET dependencies, but no luck.

How do I get a WAP project that references a C++ project that uses C++/CLI to include both the VCLibs dependencies as well as the .NET dependencies so the package app can be fully self contained?

I created a test project to demonstrate. https://github.com/dryms35/TestApp

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.