在csproj中导入Project不会将Geckofx文件复制到目标文件夹

时间:2019-04-15 22:56:44

标签: visual-studio import nuget csproj geckofx

我的dotnet项目在其NuGet依赖项中定义了GeckoFx。还原NuGet时,会将正确的文件复制到packages文件夹中。但是,在构建GeckoFx时,应将文件复制到我项目的Firefox文件夹中,但不能复制到我的项目的Firefox文件夹中。

这是我的项目.csproj文件的尾端,显示了GeckoFx的导入

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\packages\Couchbase.Lite.Support.NetDesktop.2.1.2\build\Couchbase.Lite.Support.NetDesktop.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Couchbase.Lite.Support.NetDesktop.2.1.2\build\Couchbase.Lite.Support.NetDesktop.targets'))" />
    <Error Condition="!Exists('..\packages\Geckofx45.45.0.34\build\Geckofx45.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Geckofx45.45.0.34\build\Geckofx45.targets'))" />
  </Target>
  <Import Project="..\packages\Couchbase.Lite.Support.NetDesktop.2.1.2\build\Couchbase.Lite.Support.NetDesktop.targets" Condition="Exists('..\packages\Couchbase.Lite.Support.NetDesktop.2.1.2\build\Couchbase.Lite.Support.NetDesktop.targets')" />
  <Import Project="..\packages\Geckofx45.45.0.34\build\Geckofx45.targets" Condition="Exists('..\packages\Geckofx45.45.0.34\build\Geckofx45.targets')" />

这是GeckoFx45.targets文件

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <ItemGroup>
        <Firefox Include="$(MSBuildProjectDirectory)\Firefox\*.*" />
    </ItemGroup>
    <PropertyGroup>
    <!-- Make CopyFiles target actually get executed.-->
    <BuildDependsOn>
        $(BuildDependsOn);
        CopyFiles
    </BuildDependsOn>
    <!-- Copy Firefox files to output dir -->
    </PropertyGroup>
     <Target Name="CopyFiles">
        <Copy SourceFiles="@(FIREFOX)" DestinationFolder="$(TargetDir)\Firefox" SkipUnchangedFiles="true" />
    </Target>
</Project>

在构建结束时(绿灯亮),Firefox文件夹仍然为空,这意味着该应用在尝试初始化Web浏览器时将失败。如果我手动进入并卸载/重新安装GeckoFx,则文件将被复制到Firefox文件夹中,并且一切正常。

但是我想将文件放置在正确的位置,而不必跳过NuGet重新安装箍。 我在做什么错了?

0 个答案:

没有答案