I ran into this problem when upgrading from WiX v3 to v4 and want to provide an answer that worked for me, as i did not find any here.
The Problem:
In my case i was trying to automate the proccess for upgrading my installer when changes are made to the source code. So i made a setup.build with a couple of targets. They included
The problem arises after the harvesting part, because when building the installer which is in WiX v4, it complains about the namespace added in the harvested file which is v3.
What to do?
My answer to this is maybe not that beautiful, but simple. In my Harvesting task i add an extra command that replaces the worng namespace string with the correct one. Like so:
<Target Name="Harvest">
<!-- Harvest all content of published result -->
<Exec
Command='$(WixPath)heat dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg MyWebComponents -var var.publishDir -gg -out $(WebSiteContentCode)'
ContinueOnError="false"
WorkingDirectory="." />
<Exec
Command='powershell.exe -Command "(Get-Content -Path \"path\to\HarvestedContent.wxs\") -replace \"http://schemas.microsoft.com/wix/2006/wi\", \"http://wixtoolset.org/schemas/v4/wxs\" | Set-Content -Path \"path\to\HarvestedContent.wxs\""'
ContinueOnError="false"
WorkingDirectory="." />
</Target>
This worked perfectly fine for me and you don't have to go through the headache of learning the new harvesting method of WiXv4. I hope this helps the next person who might run into this problem.