.csproj的平台特定项组可用于程序集引用,但内容不包括?
【腾讯云】亏本大甩卖,服务器4核16G 1年370元(带宽12M,系统盘120GB SSD盘,月流量2000GB)!!!!!!
云产品 配置 价格
服务器 1核2G,带宽5M,系统盘50GB SSD盘,月流量500GB 38元/年
MySQL 1核1G 19元/年
服务器 16核32G,带宽18M,系统盘250GB SSD盘,月流量5000GB 1197元/年
点我进入腾讯云,查看更多详情

Since we have three assemblies that come in explicit x86 and x64 versions, I've edited the corresponding .csproj file(s) to use, for example, a block like this:

  <ItemGroup Condition=" '$(Platform)' == 'x86' ">
    <Reference Include="CaliberRMSDK">
      <HintPath>..\Libraries\CaliberRMSDK_IKVM\32bit\CaliberRMSDK.dll</HintPath>
    </Reference>
    <Content Include="..\Libraries\CaliberRMSDK_IKVM\32bit\ikvm-native.dll">
      <Link>ikvm-native.dll</Link>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="..\Libraries\CaliberRMSDK_IKVM\32bit\JVM.dll">
      <Link>JVM.dll</Link>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup Condition=" '$(Platform)' == 'x64' ">
    <Reference Include="CaliberRMSDK">
      <HintPath>..\Libraries\CaliberRMSDK_IKVM\64bit\CaliberRMSDK.dll</HintPath>
    </Reference>
    <Content Include="..\Libraries\CaliberRMSDK_IKVM\64bit\ikvm-native.dll">
      <Link>ikvm-native.dll</Link>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="..\Libraries\CaliberRMSDK_IKVM\64bit\JVM.dll">
      <Link>JVM.dll</Link>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

When reloading the .csproj file in Visual Studio 2010 and using 'x86' as platform, all works perfectly fine. When choosing 'x64' as platform, the proper 64bit assembly reference is used BUT the linked ( <Content Include= ...> ..) always uses the 32bit ones (and therefore the app is broken).

There's no Any CPU anymore in the project files and I would have 'expected' it to work just fine for the content includes, too.. but it doesn't. Is there anything I am missing?

#0

We put the Condition attribute on the Reference element and that works fine. Perhaps the Condition attribute also needs to be added to the Content element? (Do you really need both the Reference element and the Content element?) For example:

<Reference Include="SomeLib" Condition="$(Platform)=='x86'">
  <HintPath>..\..\ThirdParty\SomeLib\clr4\x86\SomeLib.dll</HintPath>
  <Private>False</Private>
</Reference>
<Reference Include="SomeLib" Condition="$(Platform)=='x64' Or $(Platform)=='AnyCPU'">
  <HintPath>..\..\ThirdParty\SomeLib\clr4\x64\SomeLib.dll</HintPath>
</Reference>

#1

So has this question been answered? If not, I would recommend switching the order of the ItemGroups and seeing if the opposite result is achieved (that it works in x64 but on x86 Visual Studio displays the wrong reference).

#2

So this is 'only' a visual / display problem. Underneath builds do use the proper references etc, only VS2010 displays the wrong one. All good, just not visible.

推荐文章

怪异的html5清单重新加载

怪异的html5清单重新加载

推荐文章

IE中的css不透明度

IE中的css不透明度

推荐文章

将焦点设置为文本框wpf

将焦点设置为文本框wpf

推荐文章

Tomcat Catalina错误日志未显示在控制台上

Tomcat Catalina错误日志未显示在控制台上

推荐文章

在三维地形上,给定一条三维直线,找出直线和地形之间的交点

在三维地形上,给定一条三维直线,找出直线和地形之间的交点

推荐文章

使用jquery跟踪click事件

使用jquery跟踪click事件

推荐文章

什么决定了订单验证程序的启动?

什么决定了订单验证程序的启动?

推荐文章

python中的列表格式

python中的列表格式

推荐文章

如何防止点击“#”链接跳到页面顶部?

如何防止点击“#”链接跳到页面顶部?

推荐文章

更改6个图像,然后预加载,但在更改图像之前,正在预加载这些图像

更改6个图像,然后预加载,但在更改图像之前,正在预加载这些图像

推荐文章

使用Javascript覆盖或禁用元刷新标记

使用Javascript覆盖或禁用元刷新标记

推荐文章

有没有什么方法可以在不使用javascript的情况下根据屏幕分辨率调整图像的大小?

有没有什么方法可以在不使用javascript的情况下根据屏幕分辨率调整图像的大小?

推荐文章

带两个“ON”关键字的SQL联接表?

带两个“ON”关键字的SQL联接表?

推荐文章

如何在iPhone应用程序中使用NSDayCalendarUnit

如何在iPhone应用程序中使用NSDayCalendarUnit

推荐文章

如何处理iOS开发中的自定义事件?

如何处理iOS开发中的自定义事件?

推荐文章

Fusion Charts服务器端上传

Fusion Charts服务器端上传