Search code examples
wpfvisual-studio.net-5setup-project

Create Visual Studio Setup Project using self-contained deployment mode for .NET 5


I'm trying to create a setup project for a WPF application (.NET 5) using VS Community 2019. I've installed the extension for the setup project and I'm following this guide. Since I want to deploy in a self-contained manner I've created a publishing profile and used its relative path for the Publish Items => PublishProfilePath entry in the setup project. However when I try to build I get the following error:

"Could not find the publishing profile ... used in project output group 'Publish Items from ... (Active)"

So is it at all possible to build a self-contained setup project? Also it's confusing that VS says that the "PublishProfilePath" is only used for .NET Core 3 projects whereas the guide mentioned above seems to indicate that it can be used for .NET Core 3 and above.

Any suggestions on this are highly appreciated.


Solution

  • Finally figured it out. The mistake I made was using the wrong path (the "Target location" from the publishing profile):

    target location

    So the correct way to do this is as follows:

    1. Create a publish profile which is automatically named like this: FolderProfile.pubxml

    2. Make the following entry in "PublishProfilePath" (don't forget to prepend "Properties\PublishProfiles"): PublishProfilePath entry

    Then it is possible to build a self-contained installer.