通过导入包含dll参考的props文件来添加dll参考

时间:2018-12-03 18:34:27

标签: vsprops

我想知道是否可以通过将“ CognexHelper.props”导入项目文件“ XXXXX.vcxproj”来添加dll引用,而不是通过打开属性窗口手动添加dll引用。

我没有通过以下方式做到这一点。我的方式有什么问题吗?还是不可能?

下面是一个名为“ CognexHelper.props”的道具文件的内容。

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets" />
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup />
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">       
    <ItemGroup>
        <Reference>
          $(SolutionDir)bin64\Cognex.VisionPro.dll>
        </Reference>
    </ItemGroup>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">     
    <ItemGroup>
      <Reference>
          $(SolutionDir)bin64\Cognex.VisionPro.dll>
      </Reference>
    </ItemGroup>
  </ItemDefinitionGroup>
  <ItemGroup />
</Project>

下面是“ XXXXX.vcsproj”中的ImportGroup

<ImportGroup Label="PropertySheets" 
  Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"         
  Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" 
  Label="LocalAppDataPlatform" />
<Import Project="$(SolutionDir)props\CognexHelper.props" />
</ImportGroup>

0 个答案:

没有答案