Visual Studio 安装项目 Team Build 输出与本地构建不同

发布于 2025-01-07 08:19:51 字数 491 浏览 1 评论 0原文

我有一个 Visual Studio 2010 安装项目 (.vdproj),它经常出现问题。尽管我尝试从项目文件中排除或删除它,但安装项目中存在一个依赖项,该依赖项包含在安装程序中。我可以使用 Visual Studio 从依赖项中排除程序集,然后生成项目,并且本地计算机上的输出将不包括排除的程序集。当我签入项目并使用 TFS (2008) 进行构建时,程序集始终包含在内。

有问题的程序集是我排除的多个程序集之一,因为它们已经作为项目输出包含在设置项目中。因此,安装程序最终可能会得到同一程序集的两个副本,如果它尝试将它们写入同一位置(GAC 或 bin 文件夹),则安装会失败,并显示 文件使用错误。

我经常会发现,当我重新打开安装项目时,排除标志已恢复为false

这确实非常烦人,并且浪费了大量时间,因为现在我使用 Orca 加载每个构建,以尝试确保输出中不存在重复的程序集。有什么办法可以解决这个问题吗?

I have a Visual Studio 2010 setup project (.vdproj) that constantly misbehaves. There is a dependency in the setup project that gets included in the installer despite my attempts to exclude it or delete it from the project file. I can exclude the assembly from the dependencies using Visual Studio, then build the project, and the output on my local machine will not include the excluded assembly. When I check in the project and build using TFS (2008), the assembly is always included.

The assembly in question is one of a number I exclude because they are already included in the setup project as project outputs. So the installer can end up with two copies of the same assembly and if it attempts to write them to the same location, either the GAC or the bin folder, the installation fails with a file in use error.

And often I'll find that when I re-open the setup project, the Exclude flag has reverted to false.

This is really quite annoying and wastes a fair amount of time because now I use Orca to load up each build to try to ensure that the duplicate assemblies aren't present in the output. Is there any way to resolve this?

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

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

发布评论

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

评论(2

旧人哭 2025-01-14 08:19:51

Visual Studio 安装项目基本上已被弃用,并且已经很长时间没有看到重大工作了。除了您看到的问题之外,他们在与 Team Build 结合时还存在许多其他问题。

请参阅:http://msdn.microsoft.com/en-us/library/ee721500 .aspx

注意

Visual Studio 的未来版本将不包含 Visual Studio 安装程序项目模板。为了保留客户对 Visual Studio Installer 项目的现有投资,Microsoft 将根据产品生命周期策略继续支持 Visual Studio 2010 附带的 Visual Studio Installer 项目。有关详细信息,请参阅针对企业和个人的扩展 Microsoft 支持生命周期策略。开发产品。

看看 Wix 作为这些项目的替代品

Visual Studio Setup Projects are essentially deprecated and haven't seen major work in ages. Apart from the issue you're seeing, they have a lot of other issues in combination with Team Build.

See: http://msdn.microsoft.com/en-us/library/ee721500.aspx

Caution

Future versions of Visual Studio will not include the Visual Studio Installer project templates. To preserve existing customer investments in Visual Studio Installer projects, Microsoft will continue to support the Visual Studio Installer projects that shipped with Visual Studio 2010 per the product life-cycle strategy. For more information, see Expanded Microsoft Support Lifecycle Policy for Business & Development Products.

Have a look at Wix as a replacement for these projects.

软的没边 2025-01-14 08:19:51

我在 msdn 上找到了此页面,该页面有一个解决方法排除标志被重置为False

重新打开解决方案时会再次包含之前排除的文件

当您从安装项目中排除某个文件时,您可能会发现在关闭并重新打开解决方案后该文件又被包含在内。如果来自两个不同源位置的同一 DLL 文件有两个副本,则可能会发生这种情况。

要解决此错误,请更改其中一个文件的“复制本地”属性:

在解决方案资源管理器中,单击要删除的 DLL 引用。

在“视图”菜单上,单击“属性窗口”。

将“复制本地”属性更改为 False。

不幸的是,这个解决方案对我不起作用,因为安装项目是针对 ASP.NET 网站的,但 Microsoft 解决方法已记录在此处以供将来参考。

我想我已经确定了为什么存在依赖性。该网站引用了许多项目的项目成果。预编译站点后,将构建引用的项目程序集并将其放入 bin 文件夹中。然后,安装项目将它们标识为依赖项,尽管安装项目已经包含这些项目的项目输出。我在安装项目中使用项目输出的原因是因为 TFS 喜欢签入预编译的 Web 文件夹中包含的 dll,该文件夹是解决方案文件结构的一部分。这有时会导致生成的安装程序中出现旧版本或不正确版本的 dll。

我的解决方法是编辑 TFSBuild.proj 文件并添加一个任务以从预编译的 bin 目录中删除这些 dll。然后在构建安装程序时它们将不会被识别为依赖项。

I found this page on msdn that has a work-around for the Exclude flag being reset to False:

Previously excluded files are included again when the solution is re-opened

When you exclude a file from a Setup project, you may see that the file is included again after you close and re-open the solution. This may occur if there are two copies of the same DLL file from two different source locations.

To work around this error, change the Copy Local property on one of the files:

In Solution Explorer, click on the DLL reference that you want to remove.

On the View menu, click Properties Window.

Change the Copy Local property to False.

Unfortunately this solution isn't going to work for me because the setup project is for an ASP.NET website but the Microsoft work-around is documented here for future reference.

I think I've established why the dependency is present. The website references the project outputs from a number of projects. When the site is precompiled, the referenced project assemblies are built and dropped into the bin folder. The setup project then identifies them as dependencies, despite the setup project already including the project outputs for those projects. The reason I use the project outputs in the setup project is because TFS likes to checkin dlls contained in the precompiled web folder which is part of the file structure of the solution. This has sometimes resulted in old or incorrect versions of dlls being present in the resulting installer.

The work-around for me is to edit the TFSBuild.proj file and add a task to delete those dlls from the precompiled bin directory. Then they won't be identified as dependencies when building the installer.

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