引用的 DLL 未复制到引用项目 [英] Referenced DLL not being copied to referencing project

查看:26
本文介绍了引用的 DLL 未复制到引用项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题可能已经被问过多次了,也许我只是不擅长使用这里的搜索功能以及谷歌,但我还没有找到这个问题的答案.

This question might have been asked multiple times and maybe I'm just bad at using the search functions here aswell as google but I've not found an answer to this question as of yet.

我目前有两个项目,项目 X、项目 Y 和项目 Z(仅保存映射)

I've currently got two projects, project X, project Y and project Z (which only holds the mappings)

Project X 是一个 FluentNhibernate 项目,它包含我的 sessionfactories 和类似的东西.所以这也是加载映射和事情的地方(这很重要,我怀疑这可能是我遇到问题的全部原因)

Project X is a FluentNhibernate project which holds my sessionfactories and things like this. So this is also where the mappings are loaded and things (this is important and i suspect it might be the whole reason for the problem I'm having)

现在在项目 X 中,我引用了一个使用 Microsoft.SqlServer.Types.dll 的程序集.

Now in Project X I've referenced an assembly that uses Microsoft.SqlServer.Types.dll.

项目 Y 是一项使用项目 X 进行数据库连接的服务.

Project Y is a service which uses project X for it's database connections.

所有 probjects 构建都在我的开发机器上完美地找到并运行,但是当部署到我们的服务器时,它们无法运行(运行时错误).该错误相当模糊,因为它指向一个缺失的 FluentNHibernate 程序集,但事实并非如此.

All probjects build find and run perfectly on my development machine, however when deployed to our server they failed to function (runtime errors). The error was pretty obscure since it pointed to a missing FluentNHibernate assembly which was not the case.

Procmon.exe 幸运地显示了尝试加载 Microsoft.SqlServer.Types.dll 的代码,因为服务器没有安装 SQL Server(我的客户端也没有安装,但它有一个管理工作室,很可能安装了这个 .DLL 也是如此).

Procmon.exe luckily showed the code trying to load the Microsoft.SqlServer.Types.dll which since the server does not have SQL Server installed (my client doesn't either but it has a management studio which most likely installs this .DLL aswell).

到目前为止一切顺利,复制 DLL 并且它可以工作(是的!).

So far so good, copied the DLL over and it worked (yay!).

现在我想我会将程序集添加到项目 X 以确保将此引用复制到使用项目 X 的​​其他项目.这并没有发生......所以我尝试设置复制本地"设置为真.

Now I figured i'd add the assembly to project X to make sure that this reference is copied over to other projects using project X. This didn't happen.... So i tried setting the 'Copy Local' setting to true.

遗憾的是,这仍然没有将 .dll 复制到引用项目 Y.

Sadly this still does not copy the .dll to the referencing project Y.

有没有办法实现这一点,还是这个 Visual Studio 很聪明并且意识到 Project Y 不需要这个 .dll 从而拒绝复制它?

Is there a way to make this happen or is this Visual Studio beeing clever and realizing Project Y doesn't need this .dll and thus refusing to copy it over?

(由于 Project Z 需要实际引用并且 Project X 在运行时加载此程序集,因此 Z 和 X 之间没有硬"引用)​​

(Since Project Z needs the actual reference and Project X loads this assembly @ run time there is not 'hard' reference between Z and X)

任何 Stackoverflow 天才都可以对此有所了解,因为老实说,我想知道它为什么会这样(并且理想情况下是一种让它表现得像我想要的那样的方法).

Could any Stackoverflow genius shed some light on this since honestly I'd like to know why it's behaving this way (and ideally a way to make it behave like I want it to).

推荐答案

现在我想我会将程序集添加到项目 X 中,以确保将此引用复制到使用项目 X 的​​其他项目中.这没有不会发生......所以我尝试将复制本地"设置设置为 true.

你还在谈论 Microsoft.SqlServer.Types.dll 对吗?

You are still talking about the Microsoft.SqlServer.Types.dll right?

我前段时间遇到了同样的问题,实际上 sqlserver 类型不应该在您的安装中复制和重新分发.安装"它的正确方法是下载 sql server 运行时(它包含在 sql server 管理工具中,这就是它在本地为您工作的原因).

I had the same issues some time ago, actually sqlserver types should not be copied and redistributed with your installation. The correct way to "install" it is downloading the sql server runtime (which is included in the sql server management tools, that's why it works for you locally).

因为是一段时间以前,我不能 100% 确定以下信息是否正确且是否有效,但只需尝试安装 Microsoft® SQL Server® 2012 的Microsoft® System CLR 类型.在此下载页面上展开安装说明并向下滚动到 CLR 类型下载...

Because it is some time ago, I'm not 100% sure if the following information is correct and will work, but simply try to install the Microsoft® System CLR Types for Microsoft® SQL Server® 2012 only. On this download page expand Install Instructions and scroll down to the CLR Types download...

使用此链接用于 SQL Server 2008

在目标服务器上安装它.这只会安装运行这种类型的 dll 所需的东西...

Install this on the target server. This will only install the stuff needed to run this types dll...

这篇关于引用的 DLL 未复制到引用项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆