本文介绍了AppX Packager:引用的.dll的目录结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用预编译的NuGet软件包(如zlib)进行WinRT Universal App开发.一切都可以安装和编译,但运行的应用程序最终以无法找到DLL"结尾.例外.显然,zlib.dll最终被复制到AppX \ bin \ v120 \ Win32 \ Debug \ dynamic \ cdecl中 而不只是AppX.如果我将.dll手动复制到AppX文件夹,则所有内容都可以正常运行.

I'm trying to use precompiled NuGet packages, like zlib, for WinRT Universal App development. Everything installs and compiles just fine, but running app ends up with "Unable to locate DLL" exception. Apparently, zlib.dll ends up copied into AppX\bin\v120\Win32\Debug\dynamic\cdecl instead of just AppX. If I manually copy .dll to AppX folder, everything works as a charm.

我已经建立了这样的测试解决方案:

I've set up a test solution like that:

TestDLL.Windows(一个动态库项目,从TestDLLApp.Windows引用)
TestDLL.WindowsPhone (一个动态库项目,从TestDLLApp.WindowsPhone引用)
TestDLL.Shared(.dll共享代码库)
TestDLLApp.Windows(Windows 8.1应用程序项目)
TestDLLApp.WindowsPhone (Windows Phone 8.1应用程序项目)
TestDLLApp.Shared(应用程序共享代码库)
Resources \ DLL(带有.dll的文件夹仅用于测试目的)
软件包(已安装NuGet软件包的位置)

观察结果:
TestDLL输出(testdll.dll)进入AppX文件夹(正确)
来自"Resources \ DLL"的TestDLL引用了.dll.文件夹进入"AppX \ TestDLL"; (不正确,无法找到DLL)
TestDLL NuGet .dlls进入文件夹,例如"AppX \ TestDLL \ bin \ v120 \ Win32 \ Debug \ dynamic \ cdecl". (不正确,无法找到DLL)
TestDLLApp从"Resources \ DLL"引用了.dll.文件夹进入"AppX" (正确)
TestDLLApp NuGet .dlls进入文件夹"AppX \ bin \ v120 \ Win32 \ Debug \ dynamic \ cdecl" (不正确,无法找到DLL)

TestDLL.Windows (a dynamic library project, referenced from TestDLLApp.Windows)
TestDLL.WindowsPhone  (a dynamic library project , referenced from TestDLLApp.WindowsPhone)
TestDLL.Shared (.dll shared codebase)
TestDLLApp.Windows (a windows 8.1 app project)
TestDLLApp.WindowsPhone  (a windows phone 8.1 app project)
TestDLLApp.Shared (app shared codebase)
Resources\DLL (a folder with .dll just for testing purposes)
packages (this is where installed NuGet packages go)

Observations:
TestDLL output (testdll.dll) goes into AppX folder (correct)
TestDLL referenced .dll from "Resources\DLL" folder goes into "AppX\TestDLL" (incorrect, unable to locate DLL)
TestDLL NuGet .dlls go into folder like "AppX\TestDLL\bin\v120\Win32\Debug\dynamic\cdecl" (incorrect, unable to locate DLL) 
TestDLLApp referenced .dll from "Resources\DLL" folder goes into "AppX" (correct) 
TestDLLApp NuGet .dlls go into folder like "AppX\bin\v120\Win32\Debug\dynamic\cdecl" (incorrect, unable to locate DLL)

我做错了什么?

推荐答案

复制任务可以帮助我认为,复制正确的文件到目标文件夹.

Copy Task can help I think, copy the correct file to the target folder.

-詹姆斯


这篇关于AppX Packager:引用的.dll的目录结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 08:05