Visual studio 2017 生成使用引用项目中不一致的dll体系结构

Visual studio 2017 生成使用引用项目中不一致的dll体系结构,visual-studio-2017,Visual Studio 2017,我正在Visual Studio 2017中开发一个解决方案,其中有几个项目旨在分离功能。然后将这些项目添加为其他项目的依赖项 我正在尝试构建顶级项目的64位exe,但由于某些原因,一些32位DLL正在泄漏到构建中 ------ Build started: Project: LeadtoolsLib, Configuration: Debug x64 ------ LeadtoolsLib -> C:\Users\its-rowc\source\Workspaces\Imag

我正在Visual Studio 2017中开发一个解决方案,其中有几个项目旨在分离功能。然后将这些项目添加为其他项目的依赖项

我正在尝试构建顶级项目的64位exe,但由于某些原因,一些32位DLL正在泄漏到构建中

    ------ Build started: Project: LeadtoolsLib, Configuration: Debug x64 ------
  LeadtoolsLib -> C:\Users\its-rowc\source\Workspaces\Imaging\LeadTools\bin\x64\Debug\IQLeadtools.dll
------ Build started: Project: LeadtoolsLib, Configuration: Debug Any CPU ------
  LeadtoolsLib -> C:\Users\its-rowc\source\Workspaces\Imaging\LeadTools\bin\Debug\IQLeadtools.dll
------ Build started: Project: WebServicesWrapper, Configuration: Debug x64 ------
  WebServicesWrapper -> C:\Users\its-rowc\source\Workspaces\Imaging\WebServicesWrapper\bin\x64\Debug\WebServicesWrapper.dll
------ Build started: Project: IQHyland, Configuration: Debug x64 ------
  IQHyland -> C:\Users\its-rowc\source\Workspaces\Imaging\IQHyland\bin\x64\Debug\IQHyland.dll
------ Build started: Project: PDFConverter, Configuration: Debug x64 ------
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "Leadtools.Codecs", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "Leadtools.Codecs.Fax", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "Leadtools.Codecs.Tfx", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "Leadtools.Codecs.Tif", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "Leadtools", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "Leadtools.Pdf, Version=19.0.0.0, Culture=neutral, PublicKeyToken=9cf889f53ea9b907, processorArchitecture=x86", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
  PDFConverter -> C:\Users\its-rowc\source\Workspaces\Imaging\PDFConverter\bin\x64\Debug\PDFConverter.dll
------ Build started: Project: DocProcessor, Configuration: Debug x64 ------
  DocProcessor -> C:\Users\its-rowc\source\Workspaces\Imaging\DocProcessor\bin\x64\Debug\DocProcessor.exe
------ Build started: Project: IQHylandTest, Configuration: Debug x64 ------
  IQHylandTest -> C:\Users\its-rowc\source\Workspaces\Imaging\IQHylandTest\bin\x64\Debug\IQHylandTest.exe
------ Build started: Project: IQHylandUnitTest, Configuration: Debug x64 ------
  IQHylandUnitTest -> C:\Users\its-rowc\source\Workspaces\Imaging\IQHylandUnitTest\bin\x64\Debug\IQHylandUnitTest.dll
========== Build: 8 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
一般层次结构如下所示:

PDFConverter .exe (64-bit exe with some incompatible 32-bit dlls)
    IQHyland 
    LeadtoolsLib 
        Leadtools.dll (32-bit!)
    WebServicesWrapper

IQHyland .dll (only 64-bit gets built)
    LeadtoolsLib 
        Leadtools.dll (64-bit)

LeadtoolsLib .dll (both 32 and 64 bit get built, why?)


WebServicesWrapper .dll (only 64-bit gets built)
问题是,在顶层,包含了LeadtoolsLib项目中的32位.dll,而不是64位dll

PDFConverter依赖于IQHyland,IQHyland依赖于LeadtoolsLib,然而PDFConverter也直接依赖LeadtoolsLib,我想这可能是问题的原因,尽管我仍然不知道为什么它不能获得64位版本的DLL,因为PDFConverter本身就是64位目标

当我构建时,只构建64位目标,除了LeadtoolsLib,它同时构建了32位和64位目标。我不知道为什么构建认为任何东西都需要32位版本

有什么想法吗

编辑: 配置管理器 未显示WebServicesWrapper/Debug/x64/build已选中


在解决这个问题时,我们需要确定依赖关系的来源。 Visual Studio中有两种类型的依赖项:程序集引用,如通过浏览指定的依赖项。。。对话框和项目引用

要查看这两种类型的引用,可以打开Project->Add Reference

查看直接依赖关系的一种方法是在所有项目文件中搜索HintPath,例如git grep HintPath可能会显示以下内容:

...
myproject.csproj:      <HintPath>...\path\to\LeadtoolsLib.dll</HintPath>
...

如果为同一个程序集同时包含项目引用和程序集引用,系统可能会选择其中一个而不是另一个。在这种情况下,其中一个项目首选32位库直接引用。

在“生成配置”对话框中有什么?批生成还是配置管理器?我还不完全清楚这两个方面的关系。配置管理器。它看起来像一个表格,所有项目都在一列中,所有架构都在另一列中。在原始帖子中添加了一个屏幕截图,您可以说PDFConverter直接依赖于LeadtoolsLib。您能找到并告诉我这个依赖项是如何指定的吗?例如,它是解决方案中的项目对项目依赖关系还是浏览文件。。。一种依赖?如果是后者,则指定什么路径?
...
myproject.csproj:      <HintPath>...\path\to\LeadtoolsLib.dll</HintPath>
...