为什么是64位的MSBuild加载32位扩展? [英] Why is the 64-bit MSBuild loading 32-bit extensions?

查看:275
本文介绍了为什么是64位的MSBuild加载32位扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立一个64位的机器上使用的MSBuild(V4.0)的项目。出于某种原因,MSBuild的尝试加载32位扩展,我想不通这是为什么。我已经为了阐明该问题降低了问题的最小集合

I'm attempting to build a project using MSBuild (v4.0) on a 64-bit machine. For some reason, MSBuild is attempting to load a 32-bit extension, and I cannot figure out why. I've reduced the problem to the smallest set in order to demonstrate the issue.

使用下面的MSBuild项目文件:

Using the following MSBuild project file:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
    <Target Name="test">
        <Message Text="bin path: $(MSBuildBinPath)" />
        <Message Text="extensions path: $(MSBuildExtensionsPath)" />
        <Message Text="extensions path (x86): $(MSBuildExtensionsPath32)" />
        <Message Text="extensions path (x64): $(MSBuildExtensionsPath64)" />
    </Target>
</Project>

我得到这样的输出:

I get this output:

Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 8/27/2010 9:56:35 AM.
Project "D:\5\test.proj" on node 1 (default targets).
test:
  bin path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319
  extensions path: C:\Program Files (x86)\MSBuild
  extensions path (x86): C:\Program Files (x86)\MSBuild
  extensions path (x64): C:\Program Files\MSBuild
Done Building Project "D:\5\test.proj" (default targets).


Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.03

的MSBuild显然知道有关32位和64位扩展路径,从二进制路似乎很清楚,我是运行64位MSBuild.exe,但由于某些原因,它认为,扩展应从<$ C加载$ C>的>程序文件(x86),而不是。这引起了我的麻烦,因为我有我需要加载一个扩展,必须在一个32位/ 64位程序正确地加载,它不会加载(的MSBuild正在尝试加载32位版本的64位处理)。

MSBuild obviously knows about the 32bit and 64bit extensions path, and from the binary path it seems clear that I'm running the 64-bit MSBuild.exe, but for some reason it believes that extensions should be loaded from Program Files (x86) instead of Program Files. This is causing me trouble, as I have an extension that I need loaded, that MUST be loaded correctly in a 32bit/64bit process, and it will not load (MSBuild is attempting to load the 32bit version in a 64bit process).

为什么?

推荐答案

filed在Microsoft Connect上的错误,它被关闭,按设计,有这样的解释:

I filed a bug on Microsoft Connect, and it was closed as "By Design", with this explanation:

您是完全正确的 - 这种情况已经改变,严格来说,这是错的了。然而,这是一个明智的决定。它被改变的原因是其他产品安装非常多的扩展名(如.targets文件)只能安装在32位程序文件的位置。他们没料到64位的情况,但一般会工​​作得很好,在64位的MSBuild。当用户运行64位的MSBuild,现在因为它是默认的团队建设2010年是相当普遍的,MSBuildExtensionsPath将在过去解析到64位的程序文件如您所愿。然而,这意味着,没有再发现所有这些.targets文件和构建失败。这是不切合实际的得到所有这些产品,以解决他们设置的创作,特别是因为它已经向客户发货。因此,我们所做的改变,使MSBuildExetnsionsPath始终指向32位的位置。几乎没有人似乎真的希望64位的位置,而那些人可以改变MSBuildExtensionsPath64。这是真的在这里最不坏的选择的问题。

You're exactly right -- this has changed, and strictly speaking, it's wrong now. However, this was a conscious decision. The reason it was changed was that very many extensions (such as .targets files) installed by other products are only installed in the 32 bit program files location. They did not anticipate 64 bit scenarios, but generally would work just fine in 64 bit MSBuild. When a user runs 64 bit MSBuild, which is quite common now because it's the default for Team Build 2010, MSBuildExtensionsPath would have in the past resolved to the 64 bit Program Files as you expect. However this meant that all those .targets files were not longer found and the build failed. It was not practical to get all those products to fix their setup authoring, especially since it had already shipped to customers. So we made the change to make MSBuildExetnsionsPath always point to the 32 bit location. Almost nobody seems to really want the 64 bit location, and those people can change to MSBuildExtensionsPath64. It was really a question of the least bad option here.

我接受的证据,但我不同​​意的结论。我认为,破安装的作家应该有自己的分机不能在64位机器上运行。

I accept the evidence, but I disagree with the conclusion. I believe that authors of broken installers deserve to have their extensions not work on 64-bit machines.

这篇关于为什么是64位的MSBuild加载32位扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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