VS 2015项目文件加载不正确的$(平台) [英] VS 2015 Project File loading incorrect $(Platform)

查看:54
本文介绍了VS 2015项目文件加载不正确的$(平台)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为x86项目加载一个dll,为x64项目加载另一个dll,作为对项目的引用.我以前使用的是VS 2008,可以执行以下操作:

I need to load one dll for x86 projects and another dll for x64 projects as a reference to a project. I was previously using VS 2008 and could do the following:

  < PropertyGroup Condition =" '$(平台)'=='x64'">
    < ClearRef> .. \ .. \ .. \ mypath \ x64 \ mydll64.dll</ClearRef>
  </PropertyGroup>
  < PropertyGroup Condition =" '$(平台)'=='x86'<>
    < ClearRef> .. \ .. \ .. \ mypath \ x86 \ mydll.dll</ClearRef>
  </PropertyGroup>
  < ItemGroup>
    <参考包含="mydll">
     < HintPath> $(ClearRef)</HintPath>
    </参考>
    <参考包括=系统"; />
    < Reference Include ="System.Core"; />
    <参考包括="System.Xml.Linq"; />
    <参考包括="System.Data.DataSetExtensions"; />
    <参考包括="Microsoft.CSharp"; />
    <参考Include ="System.Data"; />
    <参考Include ="System.Net.Http" />
    < Reference Include ="System.Xml"; />
  </ItemGroup>

  <PropertyGroup Condition=" '$(Platform)' == 'x64' ">
    <ClearRef>..\..\..\mypath\x64\mydll64.dll</ClearRef>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Platform)' == 'x86' ">
    <ClearRef>..\..\..\mypath\x86\mydll.dll</ClearRef>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="mydll">
      <HintPath>$(ClearRef)</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>

但是,自从升级到VS 2015 Update 3以来,无论我以什么配置和平台为目标,$(Platform)始终设置为"AnyCPU".

However since upgrading to VS 2015 Update 3, $(Platform) is always set to "AnyCPU", no matter what configuration and platform I target.

是否有针对此的修复程序或解决方法?我能够重现它,从而创建一个全新的解决方案.

Is there a fix or workaround for this? I was able to reproduce it creating a brand new solution.

推荐答案

您好,erikotto,

Hi erikotto,

根据您的描述,您可以按照以下步骤修改.csproj文件:

According to your description, you could modify the .csproj file with the following steps:

1.在解决方案资源管理器中右键单击您的项目,然后选择卸载项目

1.Right click on your project in solution explorer and select Unload Project;

2.右键单击项目->编辑***.csproj.这将打开您的.csproj文件进行编辑.

2.Right click on the project-> Edit ***.csproj. This will open up your .csproj file for editing.

3.修改后,保存并关闭文件.再次在节点上右键单击项目,然后选择 重新加载项目.

3.After modifying, save and close the file. Right click the project again on the node and choose Reload Project.

此致

奥斯卡


这篇关于VS 2015项目文件加载不正确的$(平台)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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