ElDog
ElDog

Reputation: 1377

WiX installer: problems with C# project in Sdk format "The default XML namespace of the project must be the MSBuild XML namespace."

I have a solution with several projects targeting .NET Framework 4.7.2 and including WiX installer.

Everything works and builds fine.

In order to convert projects to .net standard/.net 6 I first convert one of the projects (extremely simple class library) to a modern Sdk format. At this moment the project file looks like this:

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
    <TargetFramework>net472</TargetFramework>
    <RootNamespace>MyProject</RootNamespace>
    <AssemblyName>MyProject</AssemblyName>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
    <EmbeddedResource Include="LegalNotice.rtf" />
</ItemGroup>

The library and all dependent projects build ok, but when building WiX installer it gives me the following error:

heat.exe(0,0): error HEAT5305: Failed to load project ...\MyProject.csproj: The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.

Ok, I add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the project. All projects build ok, except WiX installer which nog gives this error: heat.exe(0,0): error HEAT5307: Build failed.

Just to try I add ToolsVersion="15.0", the project file now looks like this:

<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
    <TargetFramework>net472</TargetFramework>
    <RootNamespace>MyProject</RootNamespace>
    <AssemblyName>MyProject</AssemblyName>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
    <EmbeddedResource Include="LegalNotice.rtf" />
</ItemGroup>

No luck. Like before, everything builds ok, except of WiX installer, which fails with the same 5307 error.

WiX version installed: 3.11.2 (the latest stable).

Any suggestions what could be the problem?

Upvotes: 1

Views: 518

Answers (1)

Rob Mensching
Rob Mensching

Reputation: 35901

WiX v3.11 doesn't support SDK-style projects. WiX v4 will support SDK-style projects. Supporting SDK-style projects is actually, one of the biggest if not the biggest feature in WiX v4.

Upvotes: 2

Related Questions