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

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

问题描述

这个问题可能会被多次询问,也许我只是在使用谷歌搜索功能不好,但我还没有找到这个问题的答案到目前为止。



我目前有两个项目,项目X,项目Y和项目Z(它只包含映射)

Project x是一个FluentNhibernate项目,持有我的会议和这样的事情。所以这也是映射加载和事情的地方(这是重要的,我怀疑这可能是我遇到的问题的全部原因)

现在在Project X我引用了一个使用Microsoft.SqlServer.Types.dll的程序集。
$ b Project Y是一个使用项目X进行数据库连接的服务。



所有的测试都在我的开发机器上完美地找到并运行,但是当部署到我们的服务器上时,它们失效(运行时错误)。该错误是相当晦涩的,因为它指向一个失踪的FluentNHibernate大会不是这种情况。



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

到目前为止,复制DLL,它的工作(耶!)。

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



可悲的是,这仍然不会将.dll复制到引用项目Y.



是否有办法使这种情况发生,或者这个Visual Studio是否聪明并实现了项目Y不需要这个.dll,从而拒绝复制它?



(由于项目Z需要实际引用和项目X载入这个程序集@运行时间Z和X之间没有'硬'引用)

任何Stackoverflow天才都能说明这一点,因为老实说,我想知道为什么它会这样做(理想情况下,它的行为就像我想要的那样)。

解决方案

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



您还在谈论Microsoft.SqlServer.Types.dll的权利吗?

<前段时间我有同样的问题,实际上sqlserver类型不应该复制和重新分配您的安装。正确的方式来安装它是下载sql server运行时(这是包括在sql服务器管理工​​具,这就是为什么它在本地工作)。

因为这是前一段时间,我不是100%确定,如果以下信息是正确的,将工作,但只是尝试安装。在这个下载页面展开安装说明并向下滚动到CLR类型下载...
$ b $

使用此链接适用于SQL Server 2008



在目标服务器上安装。这只会安装运行这种类型的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.

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

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)

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

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

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 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).

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

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.

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

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?

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

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).

解决方案

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.

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

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).

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...

Use this link for SQL Server 2008

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

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

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