Build использует несовместимую архитектуру dll из ссылочных проектов - PullRequest
0 голосов
/ 11 марта 2019

Я работаю над решением в 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)

Проблема в том, что на верхнем уровне включены 32-битные .dll из проекта LeadtoolsLib, а не 64-bit dlls.

PDFConverter зависит от IQHyland, который зависит от LeadtoolsLib, однако PDFConverter также напрямую зависит от LeadtoolsLib, который, как мне кажется, может вызывать проблему, хотя я до сих пор не знаю, почему он не получит 64версия библиотеки DLL с учетом того, что сам PDFConverter является 64-битной целью.

Когда я выполняю сборку, создаются только 64-битные цели, КРОМЕ LeadtoolsLib, в которой созданы как 32-битные, так и 64-битные цели,Я не знаю, почему сборка считает, что 32-битная версия необходима для чего-либо.

Есть идеи?

Редактировать: Диспетчер конфигурации Configuration manager Не показано "WebServicesWrapper / Debug / x64 / build проверен.

PDFConverter References

2>------ Build started: Project: WebServicesWrapper, Configuration: Debug x64 ------
1>  LeadtoolsLib -> C:\Users\its-rowc\source\Workspaces\Imaging\LeadTools\bin\x64\Debug\IQLeadtools.dll
3>------ Build started: Project: IQHyland, Configuration: Debug x64 ------
2>  WebServicesWrapper -> C:\Users\its-rowc\source\Workspaces\Imaging\WebServicesWrapper\bin\x64\Debug\WebServicesWrapper.dll
3>  IQHyland -> C:\Users\its-rowc\source\Workspaces\Imaging\IQHyland\bin\x64\Debug\IQHyland.dll
4>------ Build started: Project: PDFConverter, Configuration: Debug x64 ------
4>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.
4>  PDFConverter -> C:\Users\its-rowc\source\Workspaces\Imaging\PDFConverter\bin\x64\Debug\PDFConverter.dll
========== Build: 4 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

1 Ответ

0 голосов
/ 11 марта 2019

При решении этого вопроса нам нужно было определить, откуда появляются зависимости.В Visual Studio существует 2 типа зависимостей: ссылки на сборки (например, зависимости, которые вы указываете в диалоговом окне «Обзор ...») и ссылки на проекты.

Чтобы просмотреть оба типа ссылок, откройте Project ->Добавить ссылку ...

Один из способов увидеть только прямые зависимости - поиск «HintPath» во всех файлах проекта, например, «git grep HintPath» может отображать что-то вроде:

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

Если вы включите и проект, и ссылку на сборку для одной и той же сборки, система может предпочесть одну над другой (в этом случае прямая ссылка на 32-битную библиотеку предпочтительнее для одного из проектов).

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...