Select to view content in your preferred language

Is there a Dockerfile example somewhere?

1235
2
06-05-2022 04:46 PM
KirkKuykendall1
Frequent Contributor

Hi -

When I run my app in a docker container I get this exception when I try to set the APIKey:

Could not load ArcGIS Runtime (RuntimeCoreNet100_14.dll) or one of its dependencies. Ensure "Microsoft Visual C++ 2015-2019 Redistributable" is installed.

I've copied in all the dlls from C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Redist\MSVC\14.29.30133\onecore\x64\Microsoft.VC142.CRT  into the container, but still get same result.

Also tried by installing the chocolatey vcredist-all package, same result.

Thanks, Kirk

Tags (2)
0 Kudos
2 Replies
MichaelBranscomb
Esri Frequent Contributor

"Ensure "Microsoft Visual C++ 2015-2019 Redistributable" is installed." is our best guess at what went wrong during initialization - often this is the cause of this specific issue.

Can you share more information about:

  • What application framework/platform you're targeting?
  • Your application bin/output folder structure?
  • The list of VC++ redist dlls you have copied to the bin/output folder?

 

0 Kudos
KirkKuykendall1
Frequent Contributor

Thanks for responding Michael,


I think I had chocolatey configured wrong or something ... anyway, this seems to work.

# escape=`
FROM mcr.microsoft.com/windows/servercore:ltsc2019 as base

ENV CHOCO_URL=https://chocolatey.org/install.ps1
RUN powershell -Command `
 Set-ExecutionPolicy Bypass -Scope Process -Force; `
 [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12'; `
 iex ((New-Object System.Net.WebClient).DownloadString("$env:CHOCO_URL"));

RUN choco install dotnet-6.0-sdk -Y

FROM mcr.microsoft.com/windows/servercore:ltsc2019 AS build
WORKDIR /src
COPY ["ConsoleApp2/ConsoleApp2.csproj", "ConsoleApp2/"]
RUN dotnet restore "ConsoleApp2/ConsoleApp2.csproj"
COPY . .
WORKDIR "/src/ConsoleApp2"
RUN dotnet build "ConsoleApp2.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "ConsoleApp2.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ConsoleApp2.dll"]

 

Also, set this:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0-windows10.0.18362.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <DockerDefaultTargetOS>Windows</DockerDefaultTargetOS>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Esri.ArcGISRuntime" Version="100.14.0" />
    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
  </ItemGroup>

</Project>
0 Kudos