ALINK : warning AL1073: Referenced assembly 'mscorlib.dll' targets a different processor

前端 未结 7 1928
名媛妹妹
名媛妹妹 2020-12-29 19:07

We are using VS2013 and .Net 4.5.1(recently migrated, but this error is there from .Net 4.0) . This error occurs only when compiling the project in platform target x64. Is t

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-29 20:07

    Here is a workaround:

    The issue can be avoided by using the AL.EXE that matches the platform (or bitness) you are attempting to build. That is, you'll see that when you are building x64, that it is trying to use AL.EXE at a path similar to

    C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools

    If you can get it to use the x64 version of AL.exe, the issue will go away. That is, use the AL.EXE at a path similar to:

    C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\x64

    Msbuild finds this path by using its TargetFrameworkSDKToolsDirectory. Thus, using the assumption that this directory is the correct directory when building x86, the workaround below essentially appends the x64 sub directory on to the path when building x64 and leaves it as is otherwise:

    1. Create an MsBuildAL1073WarningWorkaround.targets file (name doesn't matter) and add it to the project. It has the following contents:

      
      
        
          $(TargetFrameworkSDKToolsDirectory)$(PlatformTarget)\
        
        
      
    2. Edit the .csproj file to import this file near the end of the file (where you'll see the comment that says "To modify your build process...":

       
       
      

提交回复
热议问题