I have a similar problem as this Post
I have a WiX 5 Setup Project UserInterfaceSetup.wixproj that is intended to install my WPF-Razor Project with Project file UserInterface.csproj and Publish Settings in FolderProfile.pubxml.
Even with the Attribute Publish=”true” in the ProjectReference Element of UserInterfaceSetup.wixproj, the UserInterface Project is not published when build the WiX 5 Setup Project.
When I first publish manually the UserInterface Project and then Build the WiX 5 project, then everything runs well.
Ho to have the UserInterface published automatically when building the WiX 5 Setup UserInterfaceSetup Project?
Content of UserInterface.csproj
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<OutputType>WinExe</OutputType>
<UseWPF>true</UseWPF>
<RootNamespace>CTE.HR.SmartSensorPairing.UserInterface</RootNamespace>
<AssemblyName>CTE.HR.SmartSensorPairing.UserInterface</AssemblyName>
<ApplicationIcon>wwwrootimgpaired.ico</ApplicationIcon>
<Platforms>x64</Platforms>
<PublishProfile>FolderProfile</PublishProfile>
</PropertyGroup>
<ItemGroup>
<Compile Remove="NewFolder**" />
<Content Remove="NewFolder**" />
<EmbeddedResource Remove="NewFolder**" />
<None Remove="NewFolder**" />
<Page Remove="NewFolder**" />
</ItemGroup>
<ItemGroup>
<Content Remove="nlog.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Wpf" Version="8.0.7" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.2" />
<PackageReference Include="MiniValidation" Version="0.9.0" />
<PackageReference Include="NLog" Version="5.2.8" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..CoreCore.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="ResourcesResource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Update="Resources__Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>__Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Update="wwwrootimgpaired.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="ResourcesResource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Resources__Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>__Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="nlog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
Content of FolderProfile.pubxml
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>x64</Platform>
<PublishDir>binx64Releasepublish</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
</PropertyGroup>
</Project>
Content of UserInterfaceSetup.wixproj
<Project Sdk="WixToolset.Sdk/5.0.0">
<ItemGroup>
<BindPath Include="....srcUserInterfacebinx64$(Configuration)Publish">
<BindName>BinPublishPath</BindName>
</BindPath>
</ItemGroup>
<ItemGroup>
<Content Include="imgBranding Setup.png" />
<Content Include="imgBranding Setup_58.png" />
<Content Include="imgCTE_Setup.ico" />
<Content Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.UI.wixext" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="....srcUserInterfaceUserInterface.csproj" Publish="true" />
</ItemGroup>
</Project>
Content of Package.wxs
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<?define Titel = "Test Setup"?>
<?define ProductName = "XYZ.UserInterface"?>
<?define ProductManufacturer = "XYZ" ?>
<?define DirectoryCompany = "$(var.ProductManufacturer)" ?>
<?define DirectoryProduct = "$(var.ProductName)" ?>
<Package
Name="$(var.Titel)"
Manufacturer="XYZ"
Version="!(bind.FileVersion.MainExeFile)"
UpgradeCode="ba1b4010-0adf-4dbb-bb86-60b4c1c5c618"
Compressed="yes">
<SummaryInformation Manufacturer="XYZ" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<WixVariable Id="WixUIBannerBmp" Value="imgBranding Setup_58.png"/>
<WixVariable Id="WixUIDialogBmp" Value="imgBranding Setup.png"/>
<Icon Id="icon.ico" SourceFile="imgCTE_Setup.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<Feature Id="Main" Title="$(var.ProductName)">
<ComponentGroupRef Id ="AllMyFiles"/>
<ComponentRef Id ="ExeFiles"/>
</Feature>
<ui:WixUI Id="WixUI_InstallDir_NoLicence" InstallDirectory="INSTALLFOLDER"/>
</Package>
<Fragment>
<ComponentGroup Id="AllMyFiles" Directory="INSTALLFOLDER">
<Files Include="!(bindpath.BinPublishPath)**">
<Exclude Files="!(bindpath.BinPublishPath)$(var.ProductName).exe" />
<!-- Hier entfernen weil er schon unter MainExeFile integriert ist-->
<Exclude Files="!(bindpath.BinPublishPath)appsettings.json" />
</Files>
<Component NeverOverwrite="yes" Permanent="yes">
<File Source="!(bindpath.BinPublishPath)appsettings.json" />
</Component>
</ComponentGroup>
<Component Id="ExeFiles" Guid="F13F59E5-B2AB-4676-B9E1-20A219EFBAAD" Directory="INSTALLFOLDER">
<File Id="MainExeFile" Source="!(bindpath.BinPublishPath)$(var.ProductName).exe"/>
</Component>
</Fragment>
<Fragment>
<StandardDirectory Id="ProgramMenuFolder" >
<Directory Id="XYZ" Name="XYZ"/>
</StandardDirectory>
<StandardDirectory Id="ProgramFiles6432Folder">
<Directory Id="CompanyFolder" Name="$(var.DirectoryCompany)">
<Directory Id="INSTALLFOLDER" Name="$(var.DirectoryProduct)" />
</Directory>
</StandardDirectory>
</Fragment>
</Wix>
Any help or support will be greatly appreciated.