问题
I am using VS2019 and .NET CORE 2.2 I am getting the warning AL1073
ALINK warning AL1073: Referenced assembly 'mscorlib.dll' targets a different processor
I know this is close to the question as: ALINK : warning AL1073: Referenced assembly 'mscorlib.dll' targets a different processor
BUT:
I am on .NET CORE 2.2 not on 4.x
The solutions proposed there do not work on .NET core
in particular, attempting to add:
<PropertyGroup>
<TargetFrameworkSDKToolsDirectory Condition=" '$(PlatformTarget)' == 'x64'">$(TargetFrameworkSDKToolsDirectory)\$(PlatformTarget)\
</TargetFrameworkSDKToolsDirectory>
</PropertyGroup>
gives another warning
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. C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets
Really strange, since the location is the same according to the warning!
Additionally: I would be happy to suppress the warning in the build settings, since all my unit tests pass, but adding 1073 to the list has no effect on the AL1073 warning which still appears.
Alternatively, the warning suggests: Set the "SDKToolsPath" property to the location of the Microsoft Windows SDK, how can I do that?
UPDATE to answer comment: This is hard to reproduce in a simple setup. the project references several Github projects (fo-dicom) in particular. The fo-dicom lib uses imaging libs built for 32 and 64 platforms. I did try setting to 64bits but it did not help. I saw other people raise the bug in VS community that the suppression of warning seems buggy: https://developercommunity.visualstudio.com/content/problem/224196/suppress-warnings-from-project-settings-build-does.html . That issue was closed without follow-up also MSFT stated that the AL 1073 will not be fixed, but I would like to disable! can't have warnings when using continuous integration...
I am now trying to recompile everything in .NET CORE 3.0, will provide an update if it works.
UPDATE: After recompiling in .NET CORE 3.0 I still have the issue.
回答1:
I was able to solve the issue, it seems in my case that I needed 2 things:
Suggestion from gofal3, I referenced .NET core fo-dicom package and fo-dicom dependencies (but not fo-dicom desktop).
It seems I had an old reference to Microsoft.ServiceFabric, it seems that that reference requires 64bit else we get the warning (Azure Service Fabric 32 bit support)
Lance: I tried the suggestoins in the blog to remove the warning, but that didn't help in my case. note that from the warning I was getting the path was the same.
来源:https://stackoverflow.com/questions/58555465/net-core-alink-warning-al1073-referenced-assembly-mscorlib-dll-targets-a-d