如何解决不恢复软件包的NAnt?

问题描述 投票:0回答:1

我正在尝试使用NAnt构建项目,但是,项目还原的错误是:“ \ 2.2.107 \ Sdks \ Microsoft.NET.Sdk \ targets \ Microsoft.PackageDependencyResolution.targets(208,5):错误NETSDK1064:包Microsoft.EntityFrameworkCore.Analyzers,版本2.2.4未找到。可能已删除自从NuGet恢复以来。否则,NuGet恢复可能仅部分完成,这可能是由于最大路径长度限制所致。“

我尝试过此解决方案:Jenkins not picking up the nuget restored packages

这不成功。

<target name="restore" description="Restore the nuget packages">
    <exec program="${project::get-base-directory()}\.nuget\nuget.exe">
        <arg value="restore"/>
        <arg value="${project::get-base-directory()}\solution.sln"/>
    </exec>
  </target>

  <target name="build" description="Build Solution" depends="clean,restore">
    <call target="build-all"/>
  </target>

  <target name="build-all" description="Build the web and library solutions">
     <exec program="msbuild.exe">
        <arg value="solution.sln"/>
        <arg value="/m"/>
        <arg value="/p:VisualStudioVersion=14.0"/>
        <arg value="/p:Configuration=Release"/>
        <arg value="/t:Clean"/>
        <arg value="/p:Configuration=Release"/>
      </exec>
      <exec program="msbuild.exe">
        <arg value="solution.sln"/>     
        <arg value="/p:VisualStudioVersion=14.0"/>
        <arg value="/p:Configuration=Release"/>
        <arg value="/m"/>
        <arg value="/t:Build"/>
      </exec>
     </target>
c# nant
1个回答
0
投票

仅供参考:我有一个使用包引用的.NET(不是核心)项目。我在msbuild exec中添加了一个参数来还原nuget包,并且还指定了nuget包路径。我遇到了路径问题,因为该项目已从32位版本转换为64位版本-在C:\ Windows \ system32 \ config \ systemprofile.nuget \ packages和C:\ Windows \ SysWOW64 \ config \ systemprofile之间引用不一致.nu​​get \ packages。

<exec program="${MSBuildPath}" workingdir="${build.dir}" failonerror="true" >
  <arg value="/v:d"/>
  <arg value="/p:VisualStudioVersion=15.0"/>
  <arg value="/toolsversion:15.0"/>
  <arg value="/p:Configuration=release"/>
  <arg value="/p:Platform=Mixed Platforms"/>
  <arg value="/restore"/>
  <arg value="/restoreProperty:RestorePackagesPath=${NuGetPackagesPath}"/>
  <arg value="/fileLogger"/>
  <arg value="${project.name}.sln"/>
</exec>
© www.soinside.com 2019 - 2024. All rights reserved.