'Possible to containerize a dotnet application with .net v2, .net v3 and .net 5 version for runtime?
NOTE: I have no background in
.NETapplications however I have to wrap.NETalready compiled application into a Docker Container.
I have a folder with .dll files and other specific Angular related files as well as many JSON files (and no .csproj files)
I began by using the following Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:5.0-focal-amd64
RUN apt-get update && \
apt-get install -y --no-install-recommends curl \
libgdiplus \
libharfbuzz0b \
libicu-dev \
libfontconfig1 \
libfreetype6 \
libpango-1.0-0 \
libpangocairo-1.0 && \
apt-get autoremove -y && \
apt-get purge -y --auto-remove && \
rm -rf /var/lib/apt/lists/*
/root/.dotnet/corefx/cryptography/x509stores/my/
WORKDIR /App/DeployServer/
COPY DeployServer/* .
CMD ["dotnet", "/App/DeployServer/DeployServer.dll" ]
This is throwing the following error:
Error:
An assembly specified in the application dependencies manifest (DeployServer.deps.json) was not found:
package: 'Microsoft.Data.SqlClient', version: '1.0.19249.1'
path: 'runtimes/unix/lib/netcoreapp2.1/Microsoft.Data.SqlClient.dll'
I tried finding the above mentioned path within the DeployServer.deps.json file and it has the following content
"runtime": {
"lib\/netcoreapp2.1\/Microsoft.Data.SqlClient.dll": {
"assemblyVersion": "1.0.19249.1",
"fileVersion": "1.0.19249.1"
}
},
"runtimeTargets": {
"runtimes\/unix\/lib\/netcoreapp2.1\/Microsoft.Data.SqlClient.dll": {
"rid": "unix",
"assetType": "runtime",
"assemblyVersion": "1.0.19249.1",
"fileVersion": "1.0.19249.1"
},
"runtimes\/win\/lib\/netcoreapp2.1\/Microsoft.Data.SqlClient.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "1.0.19249.1",
"fileVersion": "1.0.19249.1"
}
},
"compile": {
"ref\/netcoreapp2.1\/Microsoft.Data.SqlClient.dll": {}
}
Assuming that the runtime requirements are needed for 2.1, I went ahead and changed the image to:
FROM mcr.microsoft.com/dotnet/aspnet:2.1
however, I stumble upon the following error
It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '5.0.0' was not found.
- Check application dependencies and target a framework version installed at:
/usr/share/dotnet/
- Installing .NET Core prerequisites might help resolve this problem:
https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
- The .NET Core framework and SDK can be installed from:
https://aka.ms/dotnet-download
- The following versions are installed:
2.1.30 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
- The specified framework 'Microsoft.AspNetCore.App', version '5.0.0' was not found.
- Check application dependencies and target a framework version installed at:
/usr/share/dotnet/
- Installing .NET Core prerequisites might help resolve this problem:
https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
- The .NET Core framework and SDK can be installed from:
https://aka.ms/dotnet-download
- The following versions are installed:
2.1.30 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
It turns out in the DeployServer.deps.json there is mention of 2.1, 3.1.1, 5.0.0 and I am unable to understand how can I create a runtime which supports all the dependencies for different runtimes.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
