# Downloading the .NET Core agent

The latest version of the dot net core agent can be downloaded in two archive formats to support the native capabilities of Linux (`.tar.gz`) and Windows (`.zip`). It is especially relevant when working with containers.

All the agents from the links below are provided as self-contained applications, if you need a platform dependent version, please contact Support.

<table><thead><tr><th width="122.33331298828125">OS</th><th width="396">Download link</th><th width="220.33331298828125">Minimum System Requirements</th></tr></thead><tbody><tr><td><strong>Windows</strong></td><td><a href="https://agents.sealights.co/dotnetcore/latest/sealights-dotnet-agent-windows-self-contained.zip">https://agents.sealights.co/dotnetcore/latest/sealights-dotnet-agent-windows-self-contained.zip</a></td><td>Windows 10 build 17063 (and higher)</td></tr><tr><td><strong>Linux</strong></td><td><a href="https://agents.sealights.co/dotnetcore/latest/sealights-dotnet-agent-linux-self-contained.tar.gz">https://agents.sealights.co/dotnetcore/latest/sealights-dotnet-agent-linux-self-contained.tar.gz</a></td><td>Ubuntu 20.04 (and higher), Debian 11 (and higher), RHEL 8.10 (and higher)</td></tr><tr><td><strong>Alpine</strong></td><td><a href="https://agents.sealights.co/dotnetcore/latest/sealights-dotnet-agent-alpine-self-contained.tar.gz">https://agents.sealights.co/dotnetcore/latest/sealights-dotnet-agent-alpine-self-contained.tar.gz</a></td><td>Alpine 3.18 (and higher)</td></tr></tbody></table>

{% hint style="warning" %}
When using the Alpine version of the agent, please make sure your command are referring to the “right” executable (without file extension): `SL.DotNet` instead of `SL.DotNet.exe` or `SL.DotNet.dll`.
{% endhint %}

{% hint style="info" %}

* If you have a limitation accessing the endpoint [agents.sealights.co](http://agents.sealights.co/) and are limited to your specific server's DNS, then you can also get the agent from `https://{company}.sealights.co/dotnetcore/latest/sealights-dotnet-agent-{os}-self-contained.{archive-extension}` and replace `{company}` with your company dns prefix
* The Alpine distribution uses [musl](https://en.wikipedia.org/wiki/Musl) as the standard C library implementation, while most other Linux distributions use [glibc](https://en.wikipedia.org/wiki/GNU_C_Library) as their standard C library implementation \[[Source](https://stackoverflow.com/questions/59341750/why-cant-i-run-a-c-program-built-on-alpine-on-ubuntu)]. It means the library compiled with `glibc` depends on a different set of standard libraries, leading to a separate artifact for Alpine distributions. The code base remains the same; only the build configuration is different.
  {% endhint %}

## Downloading from NuGet <a href="#downloading-from-nuget" id="downloading-from-nuget"></a>

We’re publishing the agent also in Nuget [NuGet Gallery | sealights-technologies](https://www.nuget.org/profiles/sealights-technologies)

* Sealights.DotNet.Windows
* Sealights.DotNet.Linux
* Sealights.DotNet.Alpine

You can download the agents from there.

## Sample Scripts for download <a href="#sample-scripts-for-download" id="sample-scripts-for-download"></a>

### Download the agent  from NuGet  <a href="#download-from-nuget-the-linux-agent-version-predefined-in-the-settings-page" id="download-from-nuget-the-linux-agent-version-predefined-in-the-settings-page"></a>

In the script below:

* We download the `.nupkg` file, store it locally, and unzip it (`.nupkg` is a ZIP format)
* We create a symbolic link to the content subfolder to keep compatibility with “existing” script commands (referring to \`sl-dotnet-agent\`) and keep things short and simple

{% tabs %}
{% tab title="Windows Powershell" %}
{% code overflow="wrap" %}

```powershell
$SL_PACKAGE = "Sealights.DotNet.Windows"
$NUGET_URL = "https://www.nuget.org/api/v2/package"
$SL_VERSION = "3.13.0"

$packageName = "sealights-dotnet-windows-$SL_VERSION.nupkg"
$extractPath = "./sealights-dotnet-windows-$SL_VERSION"

Invoke-WebRequest -Uri "$NUGET_URL/$SL_PACKAGE/$SL_VERSION" -OutFile $packageName -UseBasicParsing
Expand-Archive -Path $packageName -DestinationPath $extractPath -Force
New-Item -ItemType SymbolicLink -Path "./sl-dotnet-agent" -Target "$extractPath/content" -Force | Out-Null

Write-Output "[Sealights] Installed version is: $(Get-Content ./sl-dotnet-agent/version.txt)"
```

{% endcode %}
{% endtab %}

{% tab title="Linux" %}

<pre class="language-sh" data-overflow="wrap"><code class="lang-sh"><strong>SL_PACKAGE="Sealights.DotNet.Linux"
</strong>NUGET_URL="https://www.nuget.org/api/v2/package"
SL_VERSION="3.13.0"

wget -nv -O sealights-dotnet-linux-$SL_VERSION.nupkg "$NUGET_URL/$SL_PACKAGE/$SL_VERSION"
unzip -oq sealights-dotnet-linux-$SL_VERSION.nupkg -d "./sealights-dotnet-linux-$SL_VERSION"
ln -s ./sealights-dotnet-linux-$SL_VERSION/content ./sl-dotnet-agent
echo "[Sealights] Installed version is: $(cat ./sl-dotnet-agent/version.txt)"
</code></pre>

{% endtab %}
{% endtabs %}

### Download the agent from Sealights  <a href="#download-the-agent-for-windows-zip-archive" id="download-the-agent-for-windows-zip-archive"></a>

{% tabs %}
{% tab title="Windows Powershell" %}
{% code overflow="wrap" %}

```powershell
$global:ProgressPreference = "SilentlyContinue"
iwr -OutFile sealights-dotnet-agent.zip -UseBasicParsing -Uri https://agents.sealights.co/dotnetcore/latest/sealights-dotnet-agent-windows-self-contained.zip
Expand-Archive .\sealights-dotnet-agent.zip -DestinationPath sl-dotnet-agent -Force
Write-Output "[Sealights] .NetCore Agent version is: $(Get-Content .\sl-dotnet-agent\version.txt)"
```

{% endcode %}

{% hint style="info" %}
You can deploy the token as a file in the agent folder automatically via a command like:\
`Out-File -InputObject $SL_AGENT_TOKEN -NoNewline -Force (Join-Path .\sl-dotnet-agent\ "sltoken.txt")`\
This will allow you to save the token parameter from the agent's commands.
{% endhint %}

{% hint style="warning" %}
In some Windows configurations, it may be necessary for you to enforce a compatible SSL protocol\
`[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13`
{% endhint %}
{% endtab %}

{% tab title="Linux" %}
{% code overflow="wrap" %}

```sh
wget -nv -O sealights-dotnet-agent-linux.tar.gz https://agents.sealights.co/dotnetcore/latest/sealights-dotnet-agent-linux-self-contained.tar.gz
mkdir sl-dotnet-agent && tar -xzf ./sealights-dotnet-agent-linux.tar.gz --directory ./sl-dotnet-agent
echo "[Sealights] .NetCore Agent version is: $(cat ./sl-dotnet-agent/version.txt)"
```

{% endcode %}
{% endtab %}

{% tab title="Alpine" %}
{% code overflow="wrap" %}

```sh
wget -nv -O sealights-dotnet-agent-alpine.tar.gz https://agents.sealights.co/dotnetcore/latest/sealights-dotnet-agent-alpine-self-contained.tar.gz
mkdir sl-dotnet-agent && tar -xzf ./sealights-dotnet-agent-alpine.tar.gz --directory ./sl-dotnet-agent
echo "[Sealights] .NetCore (Alpine) Agent version is: $(cat ./sl-dotnet-agent/version.txt)"
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Retrieve the agent version selected in your Settings page <a href="#security" id="security"></a>

In the script below, we retrieve the version selected in the dashboard settings page

{% tabs %}
{% tab title="Windows Powershell" %}
{% code overflow="wrap" %}

```powershell
$SEALIGHTS_URL = "mydomain.sealights.co"
$headers = @{
    accept = "application/json"
    Authorization = "Bearer $env:SEALIGHTS_AGENT_TOKEN"
}
$version = (Invoke-RestMethod "https://$SEALIGHTS_URL/api/v2/agents/dotnet/recommended" -Headers $headers).agent.version
Write-Output "[Sealights] Selected .NET version in Dashboard settings is: $version"
```

{% endcode %}
{% endtab %}

{% tab title="Linux" %}
{% code overflow="wrap" %}

```sh
$SEALIGHTS_URL="mydomain.sealights.co"

SL_VERSION=$(curl -s -X GET "https://$SEALIGHTS_URL/api/v2/agents/dotnet/recommended" -H "accept: application/json" -H "Authorization: Bearer $SEALIGHTS_AGENT_TOKEN" -L | jq -r .agent.version)
echo "[Sealights] Selected .NET version in Dashboard settings is: $SL_VERSION"
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Security <a href="#security" id="security"></a>

If you download and copy the agent manually, its files might get blocked by Windows OS.

You have two options to unblock them, to unblock them:

* Right-click both the `SL.DotNet.exe` and `SL.DotNet.dll` files and check the **Unblock** check box in the **security** section.
* You can also use the following PowerShell command: `Get-ChildItem -Path 'C:\Sealights\agent\' -Recurse | Unblock-File` ( assuming they were unzipped in the same `C:\Sealights\agent` folder)

{% hint style="info" %}
For more info, see: <https://mywindowshub.com/how-to-unblock-a-file-in-windows-10/>
{% endhint %}

<figure><img src="https://4057366433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAjqTCMRYvHhDgsdPLUnc%2Fuploads%2FZvBnfOMG5KFghggrg31P%2Fimage.png?alt=media&#x26;token=f8cc0328-fc53-45a0-ab80-b60fe430b0e3" alt=""><figcaption></figcaption></figure>
