-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning AL1073 when .resx files is compiled under x64 #5981
Comments
Thank you so much for posting this workaround! This issue has been driving me nuts for a couple of days while converting our old-style csproj files to the Microsoft.NET.Sdk format. This AL1073 warning problem has existed since forever (it is also present in .NET Framework). I used the same workaround of setting the
I would like to see this fixed in msbuild itself (to save many people's headaches), but the workaround helps for now. Note: I only get the problem when I add a second localized resource file. With just one resx file everything is fine, but adding a localized file (for example |
Note to self: get a repro of this. |
Thanks for the fix. Do you know which future update of Visual Studio will contain the fix? |
@CyberSinh This should release with VS 16.10 preview 2 |
I installed Visual Studio 16.10 RTM, and the issue is still here. |
@CyberSinh Definitely not 😟 Could you provide binlogs of your build? Also let me know if you'd rather provide them more securely in a feedback ticket. |
The issue seems to be still here if the project is rebuilt. Please find below the msbuild binlog |
@CyberSinh I think I see the issue. Could you test something for me? I'm fairly confident that adding this command line argument will fix your build: Edit: If it does fail, providing a minimal project to reproduce this issue would also help quite a bit |
No more warning with your command line argument. Well done! |
@CyberSinh To use the variable I created in the original PR 😅 I overlooked it during a refactor of that PR. See #6484 A temporary fix for your project would be to add a property group that defines |
There is some kind of a problem with multi-targeted builds and setting |
@onyxmaster I do see that net5.0 isn't calling the x64 al.exe. Is Could you do a command line build of your project and provide that binlog? Should look something like |
My apologies; it appears to be some fluke in VS 16.10. After cleaning VS temp folder |
To be clear for those hitting this, the workaround should be very similar to the workaround in the OP. Add this to your projects that need it, or into a <Target Name="FixAL1703Warning" BeforeTargets="GenerateSatelliteAssemblies" Condition="'$(PlatformTarget)' == 'x64'">
<Message Text="Adjusting SDK tools directory to use x64 version of AL.EXE" />
<PropertyGroup>
<SdkToolsPathMaybeWithx64Architecture>$(TargetFrameworkSDKToolsDirectory)$(PlatformTarget)\</SdkToolsPathMaybeWithx64Architecture>
</PropertyGroup>
</Target> |
So we figured out what the fix is for this and it'll be released along with 16.11 in the coming months. The workaround (in the post just above this) should be used in 16.10 for the time being. For those hitting this pre-16.10, the original workaround in the OP should solve your issue. Will leave the issue open until the fix is out 🙂 |
Fixes # #5981 Summary MSBuild didn't support customers using the x64 AL.exe tool by default when their projects targeted x64. #6207 implemented a fix to include x64 in the path when relevant, but this commit mistakenly forgot to update one property name which results in an empty parameter being passed. This results in the x86 version of AL.exe being the default choice. This fix changes the name of the property to the correct one that is set just before AL is called. Customer Impact Customer's that want to compile .resx files using 64-bit AL.exe require a workaround to do so. This change will allow this workaround to become default behavior. Testing Customer did a manual fix here that manually set SdkToolsPathMaybeWithx64Architecture to the value that _ALExeToolPath would be and their build succeeded. Risk Low. The previous value is preserved when not on x64, and only appends the platform to the path to AL.exe when targeting x64. Code Reviewers Description of fix Rename property passed into AL from SdkToolsPathMaybeWithx64Architecture to _ALExeToolPath, which is set a few lines above the AL call. Context #6207 introduced logic to fix the above issue. Unfortunately we need to update one location (the one that matters) to use that newly created variable. I missed this during the refactor in this commit Changes Made Update the variable used for SdkToolsPath when calling AL. Testing See the linked issue. The customer passing /p:SdkToolsPathMaybeWithx64Architecture="C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\" (the value that _ALExeToolPath has) fixed their issue. Notes _ALExeToolPath is defined just above the AL call that this PR modifies, if you're wondering where it came from.
With Visual Studio 2022, I'm getting this warning for every single C# 0x86-targeted executable project with a resource file. |
Can someone who's running into this supply a sample project that reproduces this? Or supply a binlog to this feedback ticket where it'll be confidential? It sounds like a reverse issue of the original bug 😕 |
WorkaroundFor those that hit any issue related to this in the future: set the property <PropertyGroup>
<!-- You could also condition this based on $(PlatformTarget) -->
<AlToolPath>$(TargetFrameworkSDKToolsDirectory)</AlToolPath>
</PropertyGroup> Why it worksAlToolPath is an override for the path that the AL tool would look for. If you need AL to find the x64 tool, append The Underlying IssueThe AL task looks for its own Use the workaround in the meantime while we patch this. Thanks @Thieum for supplying the repro project & binlog! |
@benvillalobos Can the variable It doesn't seem to fix the issue on my side. |
@Thieum It can be set directly in the project, but it would have to be in a target so |
That's the workaround that works for me inside the project:
|
Finally puts #5981 to bed. (to trigger an auto-close: fixes #5981) ### Context The underlying problem with the Al issues is that **the Al task finds its own tool based on the current process' architecture**. This means: x86 msbuild.exe -> x86 Al.exe x64 msbuild.exe -> x64 Al.exe Now, if your x86 msbuild.exe is building with `Platform=x64`, the x86 Al.exe gets passed `platform:x64` and logs its own warning because of mismatched platforms. So we fixed that by checking if the platform was x64, then look in the x64 tools directory in common.targets. Now we're hitting problems where the x64 msbuild.exe is calling the x64 Al.exe and being passed `platform:x86`, causing the reverse of the original issue! ### Changes Made The Al task checks the platform that was passed. If it's x86, it will find the 32 bit al.exe. If x64, it will append x64 to the path before finding the tool. This also reverts appending x64 to the tools directory in common.currentversion.targets before calling the Al task. It shouldn't have worked in today's x64 msbuild.exe, but does because of the x86 fallback behavior. Apending x64 before the task is called is no longer required. ### Testing ### Notes I allowed `_ALExeToolPath` to be overridden to account for projects that may be using it today with older msbuild binaries. **A mismatched common.currentversion.targets & microsoft.build.dll can fail**. Old targets & new dll: if platform is x64 it will double append x64, but the fallback will find the x64 al.exe. no fix required. if platform is x86 and x64 is appended to the path: will likely find the x64 tool and log the error. fix: customer should no longer append x64 to the path. new targets & old dll: for platform=x64, `x64` needs to be manually appended. The "source of truth" is setting `AlToolPath` to end in `x64`. for platform=x86, no fix needed.
If this is closed, why is the issue still there in VS 2022 v. 17.0.5? What am I missing? |
@gallettoNL the latest fix was merged into the main branch but unfortunately hasn't made it into 17.0.*. It will first appear in 17.1 which is already available as a preview. |
Ok, @ladipro, stanx! |
I can confirm that this appears to be fixed in Visual Studio 2022 version 17.1 that was recently released. |
OK thanks!
Will de Haan
***@***.***
Lievestro Software B.V.
T. +31 (0) 573 43 84 44
E. ***@***.******@***.***>
I. www.lievestro.nl<http://www.lievestro.nl/>
Normaliter werk ik op maandag, dinsdag, woensdag en vrijdag voor Lievestro.
Op dit bericht is een disclaimer<http://www.lievestro.nl/disclaimer> van toepassing. Aan dit bericht kunnen geen rechten worden ontleend.
Lievestro Software B.V. is ingeschreven bij de Kamer van Koophandel onder nummer 09158210.
Statutaire zetel: Ruurlo.
Van: ContentsMayVary ***@***.***>
Verzonden: woensdag 23 februari 2022 13:07
Aan: dotnet/msbuild ***@***.***>
CC: Will de Haan ***@***.***>; Mention ***@***.***>
Onderwerp: Re: [dotnet/msbuild] Warning AL1073 when .resx files is compiled under x64 (#5981)
I can confirm that this appears to be fixed in Visual Studio 2022 version 17.1 that was recently released.
—
Reply to this email directly, view it on GitHub<#5981 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AS5BTQMLBFQ2QSODTZ47443U4TEVTANCNFSM4VEKAURQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
|
Version 17.3.6 have this problem when I work on .net 3.5 project
what should I do? |
Issue Description
msbuild reports a "Warning AL1073 Referenced assembly 'mscorlib.dll' targets a different processor" when you try to compile .resx files under x64.
Steps to Reproduce
Simply try to compile .resx file under x64 platform.
Expected Behavior
No warning.
Actual Behavior
Warning AL1073.
Analysis
msbuild seems to always call x86 al.exe even when the platform is x64.
The issue is described at this post.
The workaround is to manually add the following code in your project file:
Versions & Configurations
Visual Studio 2019 v16.8.3
WPF .NET 5.0 project
The text was updated successfully, but these errors were encountered: