WinUI3 : How to link Microsoft.WindowsAppRuntime.Bootstrap.lib statically to winui project

Harshithraj1871 1,681 Reputation points
2023-04-18T04:32:53.23+00:00

Hi, I am working on a WinUi desktop project in cpp with cmake. When we create Winui3 app in unpackaged mode, the debug folder looks like this User's image

Here it generated Microsoft.WindowsAppRuntime.Bootstrap.dll file which gets linked dynamically, so I can't move the exe to a different location and run it. I wanted to link this lib statically. I would be of great help if you could help me solve this issue

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
888 questions
{count} votes

Accepted answer
  1. Castorix31 90,441 Reputation points
    2023-04-18T07:42:05.4733333+00:00
    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Jeanine Zhang-MSFT 11,351 Reputation points Microsoft External Staff
    2023-04-20T06:46:12.1933333+00:00

    Hello,

    Welcome to Microsoft Q&A!

    i added the lib path and lib to additional dependency, and tried launching the app from file explorer after deleting the dll, but it gave dll not found error

    Not all .lib files are static libraries.

    If you want to link a static library, first of all, you have to make sure that the *.lib you have is a real static library, not an import library of a dynamic library. According to your description, What you added is an import library not a static library

    Thank you.

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.