无法找到依赖包 (System.Runtime)
Unable to find dependent package(s) (System.Runtime)
我无法理解哪里出了问题。
我正在使用 Windows Powershell 版本:5.1.18362.628
我希望 'Magick.NET-Q8-AnyCPU' 安装。
PS C:\Users\gtamm\Source\Repos> Find-Package System.Runtime
Name Version Source Summary
---- ------- ------ -------
System.Runtime 4.1.2 nuget.org Provides the fundamental primitives, classes and base classes that define commonly-used value and reference data types, events and event handlers, interfaces, attribute...
PS C:\Users\gtamm\Source\Repos> Install-Package System.Runtime
The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'nuget.org'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
Name Version Source Summary
---- ------- ------ -------
Microsoft.NETCore.Platforms 3.1.0 nuget.org Provides runtime information required to resolve target framework, platform, and runtime specific implementations of .NETCore packages. ...
Microsoft.NETCore.Targets 3.1.0 nuget.org Provides supporting infrastructure for portable projects: support identifiers that define framework and runtime for support targets and packages that reference the mini...
System.Runtime 4.1.2 nuget.org Provides the fundamental primitives, classes and base classes that define commonly-used value and reference data types, events and event handlers, interfaces, attribute...
PS C:\Users\gtamm\Source\Repos> Install-Package -Scope AllUsers -ProviderName 'NuGet' -Name 'Magick.NET-Q8-AnyCPU'
The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'nuget.org'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
Install-Package : Unable to find dependent package(s) (System.Runtime)
At line:1 char:2
+ Install-Package -Scope AllUsers -ProviderName 'NuGet' -Name 'Magick. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (System.Runtime:String) [Install-Package], Exception
+ FullyQualifiedErrorId : UnableToFindDependencyPackage,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
您在系统上的查找出现问题。我的系统示例 ...
Get-CimInstance -ClassName Win32_OperatingSystem |
Select-Object -Property Caption, BuildNumber, Version
<#
# Results
Caption BuildNumber Version
------- ----------- -------
Microsoft Windows 10 Pro 18363 10.0.18363
#>
$PSVersionTable
<#
Name Value
---- -----
PSVersion 5.1.18362.628
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.18362.628}
BuildVersion 10.0.18362.628
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
#>
Find-Package -Name 'System.Runtime' |
Format-List
<#
# Results
FastPackageReference : $bnVnZXQub3Jn\U3lzdGVtLlJ1bnRpbWU=\NC4zLjE=\
ProviderName : NuGet
Source : nuget.org
Status : Available
SearchKey : System.Runtime
FullPath :
PackageFilename : System.Runtime.4.3.1.nupkg
FromTrustedSource : False
Summary : Provides the fundamental primitives, classes and bas...
#>
虽然我不确定,为什么您需要安装它,因为它是 Windows .Net full/core 的一部分,因此已经在您的机器上了。
Find-Package -Name 'Magick.NET*'
<#
# Results
---- ------- ------ -------
Magick.NET-Q16-AnyCPU 7.15.4 nuget.org A .NET API to the ImageMagick image-processing library for Desktop and Web.
Magick.NET-Q8-AnyCPU 7.15.4 nuget.org A .NET API to the ImageMagick image-processing library for Desktop and Web.
Magick.NET-Q16-x64 7.15.4 nuget.org A .NET API to the ImageMagick image-processing library for Desktop and Web.
...
#>
根据您的回复更新
尝试在本地手动下载/保存...
Find-Package -Name 'Magick.NET-Q8-AnyCPU' | Save-Module -Path "$env:USERPROFILE\Documents\WindowsPowerShell\Modules" -Force
...然后安装
Install-Module -Name 'Magick.NET-Q8-AnyCPU' -Force
遇到过
这向我表明,当我安装 Powershell 7 时,NuGet 可能会更新
我的解决方案是指定 nuget v2 API 而不是现在默认的 v3。
if($PSVersionTable.'PSVersion'.Major -eq 5) {
Install-Package -Name "Magick.NET-Q8-AnyCPU" -Source "https://www.nuget.org/api/v2"
} else {
Install-Package -ProviderName "NuGet" -Name "Magick.NET-Q8-AnyCPU"
}
我无法理解哪里出了问题。
我正在使用 Windows Powershell 版本:5.1.18362.628
我希望 'Magick.NET-Q8-AnyCPU' 安装。
PS C:\Users\gtamm\Source\Repos> Find-Package System.Runtime
Name Version Source Summary
---- ------- ------ -------
System.Runtime 4.1.2 nuget.org Provides the fundamental primitives, classes and base classes that define commonly-used value and reference data types, events and event handlers, interfaces, attribute...
PS C:\Users\gtamm\Source\Repos> Install-Package System.Runtime
The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'nuget.org'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
Name Version Source Summary
---- ------- ------ -------
Microsoft.NETCore.Platforms 3.1.0 nuget.org Provides runtime information required to resolve target framework, platform, and runtime specific implementations of .NETCore packages. ...
Microsoft.NETCore.Targets 3.1.0 nuget.org Provides supporting infrastructure for portable projects: support identifiers that define framework and runtime for support targets and packages that reference the mini...
System.Runtime 4.1.2 nuget.org Provides the fundamental primitives, classes and base classes that define commonly-used value and reference data types, events and event handlers, interfaces, attribute...
PS C:\Users\gtamm\Source\Repos> Install-Package -Scope AllUsers -ProviderName 'NuGet' -Name 'Magick.NET-Q8-AnyCPU'
The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'nuget.org'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
Install-Package : Unable to find dependent package(s) (System.Runtime)
At line:1 char:2
+ Install-Package -Scope AllUsers -ProviderName 'NuGet' -Name 'Magick. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (System.Runtime:String) [Install-Package], Exception
+ FullyQualifiedErrorId : UnableToFindDependencyPackage,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
您在系统上的查找出现问题。我的系统示例 ...
Get-CimInstance -ClassName Win32_OperatingSystem |
Select-Object -Property Caption, BuildNumber, Version
<#
# Results
Caption BuildNumber Version
------- ----------- -------
Microsoft Windows 10 Pro 18363 10.0.18363
#>
$PSVersionTable
<#
Name Value
---- -----
PSVersion 5.1.18362.628
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.18362.628}
BuildVersion 10.0.18362.628
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
#>
Find-Package -Name 'System.Runtime' |
Format-List
<#
# Results
FastPackageReference : $bnVnZXQub3Jn\U3lzdGVtLlJ1bnRpbWU=\NC4zLjE=\
ProviderName : NuGet
Source : nuget.org
Status : Available
SearchKey : System.Runtime
FullPath :
PackageFilename : System.Runtime.4.3.1.nupkg
FromTrustedSource : False
Summary : Provides the fundamental primitives, classes and bas...
#>
虽然我不确定,为什么您需要安装它,因为它是 Windows .Net full/core 的一部分,因此已经在您的机器上了。
Find-Package -Name 'Magick.NET*'
<#
# Results
---- ------- ------ -------
Magick.NET-Q16-AnyCPU 7.15.4 nuget.org A .NET API to the ImageMagick image-processing library for Desktop and Web.
Magick.NET-Q8-AnyCPU 7.15.4 nuget.org A .NET API to the ImageMagick image-processing library for Desktop and Web.
Magick.NET-Q16-x64 7.15.4 nuget.org A .NET API to the ImageMagick image-processing library for Desktop and Web.
...
#>
根据您的回复更新
尝试在本地手动下载/保存...
Find-Package -Name 'Magick.NET-Q8-AnyCPU' | Save-Module -Path "$env:USERPROFILE\Documents\WindowsPowerShell\Modules" -Force
...然后安装
Install-Module -Name 'Magick.NET-Q8-AnyCPU' -Force
遇到过
这向我表明,当我安装 Powershell 7 时,NuGet 可能会更新
我的解决方案是指定 nuget v2 API 而不是现在默认的 v3。
if($PSVersionTable.'PSVersion'.Major -eq 5) {
Install-Package -Name "Magick.NET-Q8-AnyCPU" -Source "https://www.nuget.org/api/v2"
} else {
Install-Package -ProviderName "NuGet" -Name "Magick.NET-Q8-AnyCPU"
}