简体   繁体   English

package 找不到版本为 4.0.5 的 Npgsql

[英]The package Npgsql with version 4.0.5 could not be found

I am trying to build a solution on my jenkins pipeline using MSBuild. Here are the stages:我正在尝试使用 MSBuild 在我的 jenkins 管道上构建解决方案。以下是阶段:

  1. Checkout查看
  2. Restore Nuget Packages恢复 Nuget 包
  3. Build建造

Here is the script of my pipeline for the part related to nuget packages:这是我的管道脚本,用于与 nuget 包相关的部分:

environment {
        nuget = "C:/nuget.exe"
    }
stages {
        stage('Restore Nuget Packages') {
            steps {
                script {
                       bat '%nuget% restore "./trunk/BALANCE/TakK_BAL.sln\"'
                       }
                       
        }
        }
        stage('Build') {
            steps {
                script {
                       bat "\"${tool 'MSBuild'}\\MSBuild.exe\" \"./trunk/BALANCE/TakK_BAL.sln\" /p:Configuration=Debug /p:Platform=\"x64\" "
                       }
                       
        }
        }

The checkout and restore nuget package stages are successful but I am getting an error in the build stage saying: checkoutrestore nuget package阶段是成功的,但我在构建阶段收到错误消息:

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\NuGet\17.0\Microsoft.NuGet.targets(198,5): 
error : The package Npgsql with version 4.0.5 could not be found in 
C:\Windows\system32\config\systemprofile\.nuget\packages\, 
C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages. 
Run a NuGet package restore to download the package. 
[C:\Users\ramin.bohlouli\.jenkins\workspace\BalanceTestPipeline\trunk\BALANCE\BalanceOptimaConnector\BalanceOptimaConnector.csproj]

However, when going to:然而,当去:

C:\Windows\system32\config\systemprofile\.nuget\packages\

and also并且

%userprofile%\.nuget\packages

which is the default folder, the package with the version 4.0.5 is there.这是默认文件夹,其中包含版本 4.0.5 的 package。

It's worth mentioning that I checked inside the following path in visual studio and saw that for my project the npgsql 4.0.5 was installed.值得一提的是,我在 visual studio 中检查了以下路径,发现我的项目安装了 npgsql 4.0.5。

tools > NuGet Package Manager > Manage NuGet packages for solution tools > NuGet Package Manager > Manage NuGet packages for solution

What could be the reason and the possible solution?可能是什么原因和可能的解决方案?

Found the problem and solved it.找到问题并解决了。 The problem is that when MSBuil tries to compile, it looks into问题是当 MSBuil 尝试编译时,它会查看

C:\Windows\system32\config\systemprofile\.nuget\packages

which is not based on a x64 platform.它不是基于 x64 平台。 So if you use msbuild.exe which is for x64, the problem is solved.所以如果你使用 x64 的 msbuild.exe,问题就解决了。

You can find the x64 version of msbuild.exe in the following path: x64版本的msbuild.exe可以在以下路径找到:

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64

I spend 1 day on fixing this problem and I thought it's not something that I can take care of.我花了 1 天时间解决这个问题,我认为这不是我能解决的问题。 but sometimes big problems have simple answers.但有时大问题有简单的答案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用正确的.NET版本安装NuGet包 - Could not install NuGet package with the correct .NET version 当Npgsql团队的最新版本是2.1.0版时,Visual Studio为什么会引用Npgsql版本4.0.0.0? - Why is Visual studio referring to Npgsql, version 4.0.0.0 when the latest version release by the Npgsql team is Version 2.1.0? GoogleMaps.LocationServices NuGet包称找不到命名空间 - GoogleMaps.LocationServices NuGet package says namespace could not be found 无法找到程序集“Microsoft.SqlServer.Types”版本10或更高版本 - Assembly 'Microsoft.SqlServer.Types' version 10 or higher could not be found 无法安装软件包“ Owin 1.0.0”。 您正在尝试将此软件包安装到以'.NETFramework,Version = v4.5.2'为目标的项目中 - Could not install package 'Owin 1.0.0.' You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2' 在Visual Studio online上找不到Microsoft.SqlServer.Types的版本10或更高版本 - Microsoft.SqlServer.Types' version 10 or higher could not be found on visual studio online 找不到foreach方法的C#SqlServer.Types版本10或更高版本 - C# SqlServer.Types version 10 or higher could not be found for foreach method 如何使用通过引用的NuGet包找到的DLL的自定义版本? - How to use a custom version of one DLL otherwise found in via referenced NuGet package? 找不到提供工具箱控件 - ProvideToolBoxControl Could not be found 找不到元数据文件 - Metadate file could not be found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM