MSBuild Project task with VS22

I’m having trouble with the MSBuild using VS22. With the new version of FB I can selected v17. But I get errors almost like FB is trying to run VS2019 paths.


There’s two issues here, the first one is it’s reporting the incorrect version when it cannot find MSBuild (it is actually looking for 17 but reporting 16 when it fails).

The second is that Microsoft stopped writing anything useful to the registry which made it difficult to locate MSBuild. We look in the default install locations for VS, however that doesn’t help if it’s installed in another location (like it is on my machine).

The work around is to add some environment variables to help FB locate msbuild.

The variables have the format MSBuildXXPath and MSBuildXXPath64 where XX is the msbuild version.

On my machine I have

MSBuild17Path=E:\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin
MSBuild17Path64=E:\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64

I have fixed the typo on the location error reporting for the next update, and also added the above info about variables to the erorr message (something we should have done ages ago!).

Ok I’ll try the variables. My VS2022 is default install location though.

If it’s installed in the default location it should find it (we just tested that here).

Are you using the VS IDE or the Build tools? We just realised that although the IDE defaults to C:\Program Files (as it’s 64bit) - the build tools installer defaults to 'C:\Program Files (x86)` - we are not handling that correctly.

I have:

C:\Program Files\Microsoft Visual Studio\2022\Professional\Msbuild\Current\Bin

C:\Program Files\Microsoft Visual Studio\2022\Professional\Msbuild\Current\Bin\amd64

Not sure why it wouldn’t work then… those should be detected fine. What version/build of FB 8 are you using?

It is

Please try this build, at the least it will show a better error message.

This build works.