VS2013中目标文件中的路径错误导致错误MSB3030:无法复制文件

时间:2016-03-06 06:00:28

标签: visual-studio-2013 msbuild targets

我有openblas.targets个文件,其中包含以下内容:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemDefinitionGroup>
    <ClCompile>
      <PreprocessorDefinitions>HAS_OPENBLAS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\lib\native\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    </ClCompile>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
    <Link>
      <AdditionalDependencies>$(MSBuildThisFileDirectory)..\..\lib\native\lib\win32\libopenblas.dll.a;%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Platform)'=='x64'">
    <Link>
      <AdditionalDependencies>$(MSBuildThisFileDirectory)..\..\lib\native\lib\x64\libopenblas.dll.a;%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup Condition="'$(Platform)'=='Win32'">
    <CopyToOutput Include="$(MSBuildThisFileDirectory)..\..\lib\native\bin\win32\*.dll" />
  </ItemGroup>
  <ItemGroup Condition="'$(Platform)'=='x64'">
    <CopyToOutput Include="$(MSBuildThisFileDirectory)..\..\lib\native\bin\x64\*.dll" />
  </ItemGroup>
  <Target Name="OpenBLAS_AfterBuild" AfterTargets="AfterBuild">
    <Copy 
      SkipUnchangedFiles="true" 
      UseHardlinksIfPossible="true"
      SourceFiles="@(CopyToOutput)"  
      DestinationFolder="$(TargetDir)" />
  </Target>

</Project>

在构建将其用作依赖项的项目时会导致此错误:

E:\msCaffe\NugetPackages\OpenBLAS.0.2.14.1\build\native\openblas.targets(26,5): error MSB3030: Could not copy the file "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\x64\Microsoft.VC120.CRT\msvcr120.dll" because it was not found.
E:\msCaffe\NugetPackages\OpenBLAS.0.2.14.1\build\native\openblas.targets(26,5): error MSB3030: Could not copy the file "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\Debug_NonRedist\x64\Microsoft.VC120.DebugCRT\msvcr120d.dll" because it was not found.

这是正确的文件在

E:\Microsoft Visual Studio 12.0\VC\redist\x64\Microsoft.VC120.CRT
E:\Microsoft Visual Studio 12.0\VC\redist\Debug_NonRedist\x64\Microsoft.VC120.DebugCRT

我的VS安装在E:\Microsoft Visual Studio 12.0我不知道为什么将其视为C:\Program Files (x86)\Microsoft Visual Studio 12.0

如何解决此问题?

1 个答案:

答案 0 :(得分:0)

检查变量的路径

SourceFiles="@(CopyToOutput)"