[wix-users] Issue with Heat & MSBuild

bevan.weiss at gmail.com bevan.weiss at gmail.com
Sun Dec 26 22:29:08 PST 2021


I would have recommended replacing the usage of ToolsVersion=”12.0” with ToolsVersion=”Current”.  Having a fixed version dependency like that is horrible for people that come after you in the development.

There are generally few good reasons for doing so, and it generally only causes future issues (as you’ve encountered).

 

The same looks to apply for the Web Development Build Tools.

I would have recommended swapping out the current fixed location in the <import …> reference for a visual studio dynamic option

<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" />

Since otherwise when you hand this off to someone else (or even just upgrade your environment), their (your) development environment will also not work correctly.

 

I’m intrigued that Visual Studio seems to ignore its own ToolsVersion setting.  I guess Microsoft got tired of complaints about builds not working, so just ignore the preference value (and likely use ‘Current’ if the preferenced option can’t be found).

 

Ideal way would be to also flag the web application project as requiring the Web Development Build Tools workload.  I’m unsure how to do this, my experience has always been that Visual Studio find this out for itself somehow.  i.e. when I try to open a C++ project without having this workload installed Visual Studio automatically tells me this is the problem and offers to install it for me.  Unsure what would trigger the Web Development workload… I would have thought an ASP.NET reference or similar would have triggered it.

 

 

Bevan

 

From: Ven H <venh.123 at gmail.com> 
Sent: Monday, 27 December 2021 4:35 PM
To: Bevan Weiss <bevan.weiss at gmail.com>
Cc: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] Issue with Heat & MSBuild

 

Hi Bevan,

 

I was able to get this resolved with the help of another colleague using the following steps.

 

1. Installed Build Tools for 2013 (One of the projects had ToolsVersion=12 and hence heat was complaining and to solve this, I installed this).

2. Then it threw another error. "The imported project 'C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets' was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk". To fix this, we followed the below steps.

     a. Installed "Web Development Build Tools" workload as specified in the link (https://stackoverflow.com/questions/44061932/ms-build-2017-microsoft-webapplication-targets-is-missing)

     b. Copied the contents of C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild to C:\Program Files (x86)\MSBuild and rebooted the machine.

 

Thanks a lot for your help. Hope it helps anyone else in future.

 

On Fri, Dec 24, 2021 at 10:13 AM Ven H <venh.123 at gmail.com <mailto:venh.123 at gmail.com> > wrote:

Not sure how to get that. However, all projects (including WiX, without Heat) build fine using VS 2019 Professional. I installed VS 2017 and Build Tools for 2013 (which is for Tools Version 12).

 

 

On Fri, Dec 24, 2021 at 1:38 AM Bevan Weiss <bevan.weiss at gmail.com <mailto:bevan.weiss at gmail.com> > wrote:

What versions of MSBuild tools are your projects (in this solution) configured for? 

They all build fine when individually targeted? 

>From the GitHub issue it seems almost certain that one of your project files is asking for a ToolsVersion of 12 (hence why this version of MSBuild is being requested). 
So your solution would be to correct your projects to reference a version of MSBuild that you do have available. 

 

24 Dec 2021 06:36:52 Ven H <venh.123 at gmail.com <mailto:venh.123 at gmail.com> >:

Thank you Bevan. I did check this, but couldn't get any solution. 

 

 

On Fri, Dec 24, 2021 at 12:59 AM Bevan Weiss <bevan.weiss at gmail.com <mailto:bevan.weiss at gmail.com> > wrote: 

https://stackoverflow.com/questions/36920054/wix-toolset-build-fails-after-upgrading-from-net-4-0-to-4-6-1-cannot-load-msbu 

This seems to match your error message, and has a link back to a WiX GitHub issue. 



 

24 Dec 2021 06:27:31 Ven H <venh.123 at gmail.com <mailto:venh.123 at gmail.com> >:

Hi Bevan, 

 

Thanks a lot for your response. I think it was built using VS 2017 or before, but not quite sure. Other WiX projects build absolutely fine (with VS 2019 and WiX 3.11.2) without heat. I searched quite a bit but didn't find anything helpful. That's why I posted here. 

 

 

On Fri, Dec 24, 2021 at 12:53 AM Bevan Weiss <bevan.weiss at gmail.com <mailto:bevan.weiss at gmail.com> > wrote: 

That version number for Microsoft.Build doesn't seem to match with Visual Studio 2019. 

So what version of Visual Studio was used for the project originally? 
It seems you have a fixed reference to an old MSBuild somewhere. 

Do other WiX projects work fine? (With/without Heat) 

Have you tried to google for the problem? 


Regards, 
Bevan 

24 Dec 2021 00:42:26 Ven H via wix-users <wix-users at lists.wixtoolset.org <mailto:wix-users at lists.wixtoolset.org> >: 

> Can anyone please help with this? I searched a lot, but could not find any 
> solution. 
> 
> 
> On Wed, Dec 22, 2021 at 9:19 PM Ven H <venh.123 at gmail.com <mailto:venh.123 at gmail.com> > wrote: 
> 
>> I have a Visual Studio 2019 Professional and Votive for 2019 installed. I 
>> have WixToolSet v3.11.2 also installed. When I open an existing solution 
>> (provided by a customer), with WiX Project and try to build it, I am 
>> getting the following error. In the PreBuild event, they are calling the 
>> Heat command. Can anyone please help? I think the project was built long 
>> back with WiXToolSet v3.8. 
>> 
>> error HEAT5316: Failed to load MSBuild wrapper object: Could not load file 
>> or assembly 'Microsoft.Build, Version=12.0.0.0 <http://12.0.0.0> , Culture=neutral, 
>> PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system 
>> cannot find the file specified. 
>> 
> 
> ____________________________________________________________________ 
> WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/ 




More information about the wix-users mailing list