Dotnet restore packages in azure devops

I’ve a strange problem..I’m trying to build a pipeline in Azure DevOps for a .net project and trying the below options which are not fruitful, Need your thoughts on this.

I’m trying to build a solution file (.sln) for a .net project in Azure DevOps. The source control used is TFVC, we have a build server, azure DevOps agent installed on it and it’s running with Network service account.

Option 1

Running the task locally to get the packages mentioned in packages folder in nuget.config

Output – It’s not picking my mentioned packages path in nuget.config file instead it is picking C:Program Filesdotnetlibrary-packs

option 2

Our build server doesn’t access the Internet, So I’m trying to enable the proxy setting for IE using below script in azure DevOps pipeline using powershell task – Passing proxy server and by passlist in arguments list

Still this option also doesn’t work and its stats below **Erroras running the ‘restore’ operation with an ‘HTTP’ source: we don’t have certificate and when tried to apply a wildcard cert, unable to update the bindings- for http port used is 8080 and for https- “443 is not working”.

Option 1 -Running the task locally to get the packages mentioned in packages folder in nuget.config

For it I’ve created a “dotnet restore” task having below details

Display name – Restore Command- restore Path to projects- **/*.sln Feeds and authentication – Feeds to use I selected – Feeds in my NuGet.config Mentioned my nuget.config path (placed config file in the build server path)

**Nuget.config **

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <add key="enabled" value="False" />
    <add key="automatic" value="False" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="format" value="0" />
    <add key="disabled" value="False" />
  </packageManagement>
  <packageSources>

      <add key="Microsoft Visual Studio Offline Packages" value="E:packages" />

  </packageSources>
</configuration>

Packages folder has all the required packages in the path.

When I try to run the task, it is picking the path – It throws error stating as below

error NU1101: Unable to find package Microsoft.NETCore.App.Ref. No packages exist with this id in source(s): C:Program Filesdotnetlibrary-packs, Microsoft Visual Studio Offline Packages error NU1102: Unable to find package Microsoft.WindowsDesktop.App.Ref with version (= 6.0.30) error NU1102: – Found 1 version(s) in Microsoft Visual Studio Offline Packages [ Nearest version: 6.0.31 ] error NU1102: – Found 0 version(s) in C:Program Filesdotnetlibrary-packs error NU1102: Unable to find package Microsoft.AspNetCore.App.Ref with version (= 6.0.30)

It’s not picking my mentioned packages path in nuget.config file instead it is picking C:Program Filesdotnetlibrary-packs

Note- The above-mentioned packages 6.0.30 and 6.0.31 are placed in the “E:packages”

option 2:

Our build server doesn’t access the Internet, So I’m trying to enable the proxy setting for IE using below script in azure DevOps pipeline using powershell task – Passing proxy server and by passlist in arguments list

First Task – Proxy enable script

param ( [string]$ProxyServer, [string]$BypassList )

Set the execution policy

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser -Force

Function to run command as administrator

function Run-AsAdmin { param ( [string]$command )

$processInfo = New-Object System.Diagnostics.ProcessStartInfo
$processInfo.FileName = "powershell.exe"
$processInfo.Arguments = "-Command `"& { $command }`""
$processInfo.Verb = "runas"
$processInfo.WindowStyle = "Hidden"

$process = New-Object System.Diagnostics.Process
$process.StartInfo = $processInfo

try {
    $process.Start() | Out-Null
    $process.WaitForExit()
} catch {
    Write-Error "Failed to run as administrator: $_"
}

}

Set the proxy settings

$proxyCommand = "netsh winhttp set proxy $ProxyServer bypass-list=$BypassList" Run-AsAdmin -command $proxyCommand Write-Host "Proxy settings: HTTP_PROXY=$ProxyServer , bypass-list=$BypassList"

Verify the settings

Run-AsAdmin -command "netsh winhttp show proxy"

The Output shows the proxy server and Bypasslist details, not sure if the above is really enabling the proxy.

**Second Task – dotnet core**

Display name – Restore

Command- restore

Path to projects- **/*.sln

Feeds and authentication – Feeds to use I selected – Feed(s) I select here

Use packages from this Azure Artifacts feed- Created a feed in Azure Artifact – BuildPackages

checked -Use packages from NuGet.org

**Nuget.config**

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <add key="enabled" value="False" />
    <add key="automatic" value="False" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="format" value="0" />
    <add key="disabled" value="False" />
  </packageManagement>
  <packageSources>

      <add key="nuget.org" value="https://www.nuget.org/api/v2/" /> 
      <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />

  </packageSources>
</configuration>

Still this option also doesn’t work and it stats below **Error:**

error NU1302: You are running the ‘restore’ operation with an ‘HTTP’ source: http://<tfsurl>_packaging/BuildPackages/nuget/v3/index.json. NuGet requires HTTPS sources. To use an HTTP source, you must explicitly set ‘allowInsecureConnections’ to true in your NuGet.Config file. Please refer to https://aka.ms/nuget-https-everywhere for more information.

Please let me know what changes needs to be done.

Appreciate your help!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật