为什么“检测到的依赖项”下的程序集的排除属性会被删除?在 vdproj 中不存在?

发布于 2024-12-14 10:46:00 字数 371 浏览 1 评论 0原文

我有一个简单的问题。我想在我的安装项目中排除一些 dll 依赖项(在检测到的依赖项文件夹中),这样它们就不会被复制到用户安装文件夹中。我通过将不需要的程序集的“排除”属性设置为 true 来解决这个问题,然后构建 msi 文件。它工作正常,程序集被排除。

但是,如果我关闭 Visual Studio 并重新加载它,则只有“排除”属性之一(在我的情况下设置了 4 个)保持设置为 true。我检查了 vdproj 文件,其中有 4 行,如下所示:

"Exclude" = "11:TRUE"

... 一行代表我想要排除的每个程序集。

所以看来 VS2010 没有正确从 vdproj 文件加载设置。我很困惑。有人有解决方法吗?

I have a simple problem. I want to exclude some of the dll dependencies (in the detected dependencies folder) in my setup project so they don't get copied into the users install folder. I solved it by setting the 'exclude' property to true on the assemblies I don't want, and then building the msi file. It works fine, the assemblies are excluded.

However, if I close visual studio and reload it, only one of the 'exclude' properties (of 4 in my case that I set) stays set to true. I checked the vdproj file and there are 4 lines in there like this:

"Exclude" = "11:TRUE"

... one for each of the assemblies I wanted excluded.

So it seems VS2010 is not correctly loading the settings from the vdproj file. I'm mystified. Does anyone have a workaround?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一袭水袖舞倾城 2024-12-21 10:46:00

这是因为当 DLL 的“复制本地”属性设置为 true 时,依赖项分析器总是将 DLL 添加到部署项目中。请参阅 MSDN 文章 安装和部署项目疑难解答。您必须选择使用 Visual Studio 的“复制本地”还是使用部署项目将文件安装在正确的位置,尤其是在复杂的解决方案中。

It's because the dependency analyzer always adds DLLs to the deployment project when their Copy Local properties are set to true. See the section titled "Previously excluded files are included again when the solution is re-opened" in the MSDN article, Troubleshooting Setup and Deployment Projects. You'll have to choose between using Visual Studio's Copy Local and using your deployment project to install files in the right place, especially in a complex solution.

多孤肩上扛 2024-12-21 10:46:00

这是为所有来这里寻找解决方案的人准备的!

好吧,我遇到了与上面提到的相同的问题,但我想避免的 DLL 是检测到的依赖项(我的项目 A 依赖于 B.dll,它依赖于 C.Dll(2.0.0.0)),但我不想要 C .dll(2.0.0.0) 在我的 MSI 中(因为我直接依赖于另一个版本的 C.dll (1.0.0.0))。我尝试排除 DLL,但这不起作用,因为每次重新加载项目时 VDProj 都会刷新依赖项并将检测到的依赖项添加回来。

Microsoft 的解决方案是将引用的 DLL 的“CopyLocal”属性设置为 false,我有很多这样的 DLL,并且我不想转到每个项目并更新它(因为这会导致测试工作量猛增)因为根据测试人员的说法,实际上正在更改许多项目的代码)。因此,我通过手动将特定的 DLL (C.Dll (1.0.0.0)) 添加到安装项目来解决这个问题。只需右键单击安装项目并选择添加文件即可。

在此处输入图像描述

还记得设置您想要部署文件的位置,在我的例子中,它是到 BIn 文件夹。

在此处输入图像描述

此文件将覆盖所有其他检测到的依赖项(具有相似的名称)并部署到我们的位置指定。

This is for all the people who come here looking for a solution!

Well I had the same problem as mentioned above, but the DLL which I wanted to avoid is a detected depedency (my project A depends on B.dll which has a dependency to C.Dll(2.0.0.0)) but I dont want C.dll(2.0.0.0) in my MSI (as I have a direct dependency to another version of C.dll (1.0.0.0)). I tried to exclude the DLL but that wont work as VDProj refreshes the dependency everytime I reload the project and adds the detected dependency back.

The solution from Microsoft was to make the "CopyLocal" property to false for the referenced DLL, I had so many of these DLL's and I did not wanted to go to each project and update this (as this would cause the testing effort to sky rocket because as per the testers am virtually changing code for a lot of projects). So I worked around this by adding the particular DLL (C.Dll (1.0.0.0)) to the setup project manually. Just right click the setup project and select add file.

enter image description here

also remember to set the location to which you want the file to be deployed, in my case it was going to the BIn folder.

enter image description here

This file would override all the other detected dependencies (with similar name) and get deployed to the location which we specify.

伴我老 2024-12-21 10:46:00

我知道这是一个非常古老的话题。

但对我有用的解决方案是:

  1. 优化所有依赖项目的所有引用。
  2. 删除彼此之间所有重复的引用。

它彻底解决了问题。甚至尝试使用 Microsoft 解决方案(此处提到:https://stackoverflow.com/a/12918739/10746857)解决这两点并没有成功。

I know it's a very old topic.

But the solution that worked for me was:

  1. optimize all references from all dependent projects.
  2. remove all duplicated references between each other.

It solved completely the problem. Even trying to use the Microsoft solution (mentioned here: https://stackoverflow.com/a/12918739/10746857) without solving these two points hasn't worked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文