Visual studio 如何使用PackageReferences将Microsoft.ReportingServices.ReportViewerControl.WebForms NuGet包安装到非SDK样式的项目中?
我清理了VS IDE中的NuGet缓存,并运行了Visual studio 如何使用PackageReferences将Microsoft.ReportingServices.ReportViewerControl.WebForms NuGet包安装到非SDK样式的项目中?,visual-studio,nuget,Visual Studio,Nuget,我清理了VS IDE中的NuGet缓存,并运行了NuGet locals http缓存-clear 正在尝试安装程序包: NuGet软件包管理器GUI Restoring packages for C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj... GET https://api.nuget.org/v3-flatcontainer/microsoft.sqlserver.types/index.json GE
NuGet locals http缓存-clear
正在尝试安装程序包:
NuGet软件包管理器GUI
Restoring packages for C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj...
GET https://api.nuget.org/v3-flatcontainer/microsoft.sqlserver.types/index.json
GET http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.sqlserver.types/index.json
GET http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a/nuget/v3/flat2/microsoft.sqlserver.types/index.json
OK http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a/nuget/v3/flat2/microsoft.sqlserver.types/index.json 48ms
NotFound http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.sqlserver.types/index.json 54ms
OK https://api.nuget.org/v3-flatcontainer/microsoft.sqlserver.types/index.json 299ms
NU1603: Microsoft.ReportingServices.ReportViewerControl.WebForms 150.1404.0 depends on Microsoft.SqlServer.Types (>= 14.0.0) but Microsoft.SqlServer.Types 14.0.0 was not found. An approximate best match of Microsoft.SqlServer.Types 14.0.314.76 was resolved.
Package restore failed. Rolling back package changes for 'DataSvc'.
Time Elapsed: 00:00:03.9174673
========== Finished ==========
NuGet软件包管理器控制台
PM> Install-Package Microsoft.ReportingServices.ReportViewerControl.WebForms
Restoring packages for C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj...
GET https://api.nuget.org/v3-flatcontainer/microsoft.sqlserver.types/index.json
GET http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.sqlserver.types/index.json
GET http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a/nuget/v3/flat2/microsoft.sqlserver.types/index.json
OK http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a/nuget/v3/flat2/microsoft.sqlserver.types/index.json 53ms
NotFound http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.sqlserver.types/index.json 59ms
OK https://api.nuget.org/v3-flatcontainer/microsoft.sqlserver.types/index.json 191ms
Install-Package : NU1603: Microsoft.ReportingServices.ReportViewerControl.WebForms 150.1404.0 depends on Microsoft.SqlServer.Types (>= 14.0.0)
but Microsoft.SqlServer.Types 14.0.0 was not found. An approximate best match of Microsoft.SqlServer.Types 14.0.314.76 was resolved.
At line:1 char:1
+ Install-Package Microsoft.ReportingServices.ReportViewerControl.WebFo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Install-Package : Package restore failed. Rolling back package changes for 'DataSvc'.
At line:1 char:1
+ Install-Package Microsoft.ReportingServices.ReportViewerControl.WebFo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Time Elapsed: 00:00:02.1740309
PM>
C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc> $env:VSToolsPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0"
C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc> $env:SolutionDir="C:\xyz\tip\"
C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc> $env:MSBuildExtensionsPath32 = "C:\Program Files (x86)\MSBuild"
C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc> dotnet add package Microsoft.ReportingServices.ReportViewerControl.WebForms
Determining projects to restore...
Writing C:\Users\mkharitonov\AppData\Local\Temp\tmp462B.tmp
info : Adding PackageReference for package 'Microsoft.ReportingServices.ReportViewerControl.WebForms' into project 'C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj'.
info : Restoring packages for C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj...
info : CACHE http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a/nuget/v3/flat2/microsoft.reportingservices.reportviewercontrol.webforms/index.json
info : GET http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.reportingservices.reportviewercontrol.webforms/index.json
info : CACHE https://api.nuget.org/v3-flatcontainer/microsoft.reportingservices.reportviewercontrol.webforms/index.json
info : NotFound http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.reportingservices.reportviewercontrol.webforms/index.json 179ms
info : CACHE http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a/nuget/v3/flat2/microsoft.sqlserver.types/index.json
info : GET http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.sqlserver.types/index.json
info : CACHE https://api.nuget.org/v3-flatcontainer/microsoft.sqlserver.types/index.json
info : NotFound http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.sqlserver.types/index.json 23ms
error: Microsoft.ReportingServices.ReportViewerControl.WebForms 150.1404.0 depends on Microsoft.SqlServer.Types (>= 14.0.0) but Microsoft.SqlServer.Types 14.0.0 was not found. An approximate best match of Microsoft.SqlServer.Types 14.0.314.76 was resolved.
info : Package 'Microsoft.ReportingServices.ReportViewerControl.WebForms' is compatible with all the specified frameworks in project 'C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj'.
info : PackageReference for package 'Microsoft.ReportingServices.ReportViewerControl.WebForms' version '150.1404.0' added to file 'C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj'.
info : Committing restore...
info : Assets file has not changed. Skipping assets file writing. Path: C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\obj\project.assets.json
log : Failed to restore C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj (in 606 ms).
C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc>
命令行
PM> Install-Package Microsoft.ReportingServices.ReportViewerControl.WebForms
Restoring packages for C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj...
GET https://api.nuget.org/v3-flatcontainer/microsoft.sqlserver.types/index.json
GET http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.sqlserver.types/index.json
GET http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a/nuget/v3/flat2/microsoft.sqlserver.types/index.json
OK http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a/nuget/v3/flat2/microsoft.sqlserver.types/index.json 53ms
NotFound http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.sqlserver.types/index.json 59ms
OK https://api.nuget.org/v3-flatcontainer/microsoft.sqlserver.types/index.json 191ms
Install-Package : NU1603: Microsoft.ReportingServices.ReportViewerControl.WebForms 150.1404.0 depends on Microsoft.SqlServer.Types (>= 14.0.0)
but Microsoft.SqlServer.Types 14.0.0 was not found. An approximate best match of Microsoft.SqlServer.Types 14.0.314.76 was resolved.
At line:1 char:1
+ Install-Package Microsoft.ReportingServices.ReportViewerControl.WebFo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Install-Package : Package restore failed. Rolling back package changes for 'DataSvc'.
At line:1 char:1
+ Install-Package Microsoft.ReportingServices.ReportViewerControl.WebFo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Time Elapsed: 00:00:02.1740309
PM>
C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc> $env:VSToolsPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0"
C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc> $env:SolutionDir="C:\xyz\tip\"
C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc> $env:MSBuildExtensionsPath32 = "C:\Program Files (x86)\MSBuild"
C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc> dotnet add package Microsoft.ReportingServices.ReportViewerControl.WebForms
Determining projects to restore...
Writing C:\Users\mkharitonov\AppData\Local\Temp\tmp462B.tmp
info : Adding PackageReference for package 'Microsoft.ReportingServices.ReportViewerControl.WebForms' into project 'C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj'.
info : Restoring packages for C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj...
info : CACHE http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a/nuget/v3/flat2/microsoft.reportingservices.reportviewercontrol.webforms/index.json
info : GET http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.reportingservices.reportviewercontrol.webforms/index.json
info : CACHE https://api.nuget.org/v3-flatcontainer/microsoft.reportingservices.reportviewercontrol.webforms/index.json
info : NotFound http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.reportingservices.reportviewercontrol.webforms/index.json 179ms
info : CACHE http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a/nuget/v3/flat2/microsoft.sqlserver.types/index.json
info : GET http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.sqlserver.types/index.json
info : CACHE https://api.nuget.org/v3-flatcontainer/microsoft.sqlserver.types/index.json
info : NotFound http://tdc1tfsapp01:8080/tfs/DefaultCollection/_packaging/854ce845-6ca2-4dae-98e0-81ffaee3f06a@85ac4ba3-ae74-4586-9d21-d28a67d51f3e/nuget/v3/flat2/microsoft.sqlserver.types/index.json 23ms
error: Microsoft.ReportingServices.ReportViewerControl.WebForms 150.1404.0 depends on Microsoft.SqlServer.Types (>= 14.0.0) but Microsoft.SqlServer.Types 14.0.0 was not found. An approximate best match of Microsoft.SqlServer.Types 14.0.314.76 was resolved.
info : Package 'Microsoft.ReportingServices.ReportViewerControl.WebForms' is compatible with all the specified frameworks in project 'C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj'.
info : PackageReference for package 'Microsoft.ReportingServices.ReportViewerControl.WebForms' version '150.1404.0' added to file 'C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj'.
info : Committing restore...
info : Assets file has not changed. Skipping assets file writing. Path: C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\obj\project.assets.json
log : Failed to restore C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc\DataSvc.csproj (in 606 ms).
C:\xyz\tip\Services\Platform\WBDataSvc\DataSvc>
同样值得注意的是—
我不明白的是,这只是一个警告。为什么它的行为像一个错误?我认为您的项目有一些节点将此警告视为导致此问题的错误 在我方中,这只是一个nuget警告,不会阻止软件包的安装 请检查
xxx.csproj
、任何导入的目标文件
或props
文件、目录.Build.props
或目录.Build.props
(如果使用)
删除这些文件上的任何节点:
<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors>NU1603</WarningsAsErrors>
</PropertyGroup>
真的
NU1603