0

The .Net Framework 4.7.1 MVC Web App Azure Build pipeline fails and give the following error. The Microsoft.Data.SqlClient.SNI.1.1.0 Nuget is updated 3.0.2 in feature branch and when I create pull request the build pipeline fails ad give the following error. Please advise

The solution has many project service layer which target both 4.7.1 and dotnet core 8.0. before it targets 4.7.1 and 6.0 now it migrated 4.7.1 and dotnet core 8.0. since the Microsoft.Data.SqlClient.SNI.1.1.0 is no compatible with 8.0 I have to migrate that to 3.0.2

   ##[error]Test\Test.csproj(2480,5): Error :
    This project references NuGet package(s) that are missing on this computer.
     Use NuGet Package Restore to download them.  
     For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. 
     The missing file is ..\packages\Microsoft.Data.SqlClient.SNI.1.1.0\build\net46\Microsoft.Data.SqlClient.SNI.targets.
2
  • What else can you tell us about the .NET solution or project that you're trying to build? Could you please edit your question and paste the pipeline tasks used? Commented Nov 6 at 13:16
  • Have you added the NuGetCommand@2 task to run the "nuget restore" before the build task? Commented Nov 7 at 1:33

1 Answer 1

0

If you want to update to "Microsoft.Data.SqlClient.SNI v3.0.2" in your projects, you need to open your solution in Visual Studio on your develop machine:

  1. Open the "Manage NuGet Packages for Solution..." on the solution.

    enter image description here

  2. On the "Manage Packages for Solution" window, you can go to the 'Updates' tab to directly update the package to version 3.0.2 for the specific projects.

    enter image description here

  3. You also can first uninstall the old version 1.1.0 for the specific projects, and then install the new version 3.0.2 for them.

    • Go to 'Installed' tab to uninstall the old version 1.1.0 for the specific projects.

      enter image description here

    • Go to 'Browse' tab to install the new version 3.0.2 for the specific projects.

      enter image description here

After above updates, push the updates from the local repository to the remote repository. Then you can run the build pipeline for the new updates on Azure DevOps.


When you build your project in build pipeline on Azure DevOps, if the agent machine is different than your develop machine, the agent machine might not have all the required packages pre-installed.

As the error message has mentioned, you need to restore/download the required packages before the build task.

To restore NuGet packages for your projects, you can use the NuGetCommand@2 task to run the 'nuget restore' command like as below.

- task: NuGetCommand@2
  displayName: 'NuGet restore'
  inputs:
    command: restore
    restoreSolution: 'path/to/solution.sln'  # Or 'path/to/project.csproj'

If your project is .NET Core or .NET Standard, you also can use the DotNetCoreCLI@2 to run the 'dotnet restore' command to restore the required NuGet packages before the build task.

- task: DotNetCoreCLI@2
  displayName: 'dotnet restore'
  inputs:
    command: restore
    projects: path/to/solution.sln  # Or 'path/to/project.csproj'

For more details, you also can reference the documentation "Troubleshooting package restore errors".


Not the answer you're looking for? Browse other questions tagged or ask your own question.