Getting rid of an AL1703 warning

Yesterday I was converting an old work-related project to the new csproj structure (using this very helpful tool by Hans van Bakel). Tackling compilation warnings one by one, I was finally left with this one:

Warning AL1073 Referenced assembly 'mscorlib.dll' targets a different processor

Some Googling revealed that this was related to .resx files and x64 platform targeting. Unfortunately, the workarounds offered on Stack Overflow didn't quite work for me. The warning was replaced by two warnings. The original one, plus this:

Microsoft.Common.CurrentVersion.targets(3628,5): warning MSB3084: Task attempted to find "al.exe" in two locations. 1) Under the "x64\‌​" processor specific directory which is generated based on SdkToolsPath 2) The x86 specific directory under "x64\‌​" which is specified by the SDKToolsPath property. You may be able to solve the problem by doing one of the following: 1) Set the "SDKToolsPath" property to the location of the Microsoft Windows SDK.

Unfortunately the suggested solution (setting SDKToolsPath) also had no effect for me. A little more digging finally gave me a solution that removed all the warnings though. Just put this somewhere in your csproj file:

<Target Name="FixAL1703Warning" BeforeTargets="GenerateSatelliteAssemblies"
        Condition="'$(PlatformTarget)' == 'x64'">
  <Message Text="Adjusting SDK tools directory to use x64 version of AL.EXE">

I hope this saves somebody some time and frustration :) As far as I know the warning doesn't actually negatively affect anything, but having unnecessary warnings just adds noise.

<sarcasm>Thanks Microsoft, for giving me this opportunity to help people by not fixing this bug!</sarcasm>

Add comment