之前曾经工作过。当我尝试使用以下命令从程序包管理器控制台创建nuget包时
nuget.exe pack $testCoreProj -Build -OutputDirectory $outputPackagePath
我收到此错误
Attempting to build package from 'Test.PageObjects.csproj'.
MSBuild auto-detection: using msbuild version '15.0' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin'.
nuget.exe : Could not load file or assembly 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
At C:\Good\GIT\mg-alfa-dev\Test.Core\CreateNuGetPackage.ps1:26 char:1
+ nuget.exe pack $testPageObjectsProj -Build -OutputDirectory $outputPa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Could not load ...file specified.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
答案 0 :(得分:0)
由于您可以在程序包管理器控制台中运行该commnad行,因此应将nuget.exe的路径添加到环境路径中。请尝试在该路径中更新nuget.exe版本(4.0以上):