简体   繁体   English

ASP.NET 核心对接嵌套项目

[英]ASP.NET core dockerising a nested project

So, I've recently come across a project I would like to dockerise which is built in do.net (I should caveat with the fact that I am not a .net developer)所以,我最近遇到了一个我想在 do.net 中构建的 dockerise 项目(我应该警告我不是 .net 开发人员)

The repo can be found here for reference:可以在此处找到回购以供参考:

https://github.com/observerly/ASCOM.Alpaca.Simulators https://github.com/observerly/ASCOM.Alpaca.Simulators

I have given it my best attempt to setup the following Dockerfile to be able to containerise this app:我已尽最大努力设置以下 Dockerfile 以便能够将此应用程序容器化:

# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /app 

# copy NuGet config
COPY NuGet.config .

# copy csproj and restore as distinct layers
COPY *.sln .
COPY ASCOM.Alpaca.Simulators/*.csproj ./ASCOM.Alpaca.Simulators/
COPY Camera.Simulator/*.csproj ./Camera.Simulator/
COPY CoverCalibratorSimulator/*.csproj ./CoverCalibratorSimulator/
COPY DomeSimulator/*.csproj ./DomeSimulator/ 
COPY FilterWheelSimulator/*.csproj ./FilterWheelSimulator/ 
COPY FocuserSimulator/*.csproj ./FocuserSimulator/ 
COPY ObservingConditionsSimulator/*.csproj ./ObservingConditionsSimulator/ 
COPY OmniSim.Tools/*.csproj ./OmniSim.Tools/ 
COPY RotatorSimulator/*.csproj ./RotatorSimulator/ 
COPY SafetyMonitorSimulator/*.csproj ./SafetyMonitorSimulator/ 
COPY SwitchSimulator/*.csproj ./SwitchSimulator/ 
COPY TelescopeSimulator/*.csproj ./TelescopeSimulator/ 

# copy WindowsBase.Vector
COPY WindowsBase.Vector/*.sln ./WindowsBase.Vector/ 
COPY WindowsBase.Vector/WindowsBase.Vector/*.csproj ./WindowsBase.Vector/WindowsBase.Vector/ 

RUN dotnet restore 

# copy everything else and build app
COPY ASCOM.Alpaca.Simulators/. ./ASCOM.Alpaca.Simulators/
COPY Camera.Simulator/. ./Camera.Simulator/
COPY CoverCalibratorSimulator/. ./CoverCalibratorSimulator/
COPY DomeSimulator/. ./DomeSimulator/ 
COPY FilterWheelSimulator/. ./FilterWheelSimulator/ 
COPY FocuserSimulator/. ./FocuserSimulator/ 
COPY ObservingConditionsSimulator/. ./ObservingConditionsSimulator/ 
COPY OmniSim.Tools/. ./OmniSim.Tools/ 
COPY RotatorSimulator/. ./RotatorSimulator/ 
COPY SafetyMonitorSimulator/. ./SafetyMonitorSimulator/ 
COPY SwitchSimulator/. ./SwitchSimulator/ 
COPY TelescopeSimulator/. ./TelescopeSimulator/ 

WORKDIR /app/ASCOM.Alpaca.Simulators
RUN dotnet publish -c Release -o out 

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
WORKDIR /app 

COPY --from=build /app/ASCOM.Alpaca.Simulators/out ./
ENTRYPOINT ["dotnet", "ASCOM.Alpaca.Simulators.dll"]

However, I am encountering the following error stack:但是,我遇到以下错误堆栈:

#44 4.204 /app/TelescopeSimulator/AstronomyFunctions.cs(282,23): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.205 /app/TelescopeSimulator/AstronomyFunctions.cs(379,47): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.205 /app/TelescopeSimulator/AstronomyFunctions.cs(379,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.205 /app/TelescopeSimulator/AstronomyFunctions.cs(395,47): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.205 /app/TelescopeSimulator/AstronomyFunctions.cs(395,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.205 /app/TelescopeSimulator/MountFunctions.cs(25,51): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.206 /app/TelescopeSimulator/MountFunctions.cs(25,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.206 /app/TelescopeSimulator/MountFunctions.cs(64,52): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.207 /app/TelescopeSimulator/MountFunctions.cs(64,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.207 /app/TelescopeSimulator/MountFunctions.cs(97,51): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.207 /app/TelescopeSimulator/MountFunctions.cs(97,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.207 /app/TelescopeSimulator/MountFunctions.cs(123,52): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.207 /app/TelescopeSimulator/MountFunctions.cs(123,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.207 /app/TelescopeSimulator/MountFunctions.cs(159,42): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.208 /app/TelescopeSimulator/MountFunctions.cs(159,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.208 /app/TelescopeSimulator/MountFunctions.cs(168,43): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.209 /app/TelescopeSimulator/MountFunctions.cs(168,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.209 /app/TelescopeSimulator/MountFunctions.cs(177,41): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.210 /app/TelescopeSimulator/MountFunctions.cs(177,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.210 /app/TelescopeSimulator/TelescopeHardware.cs(1497,43): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.210 /app/TelescopeSimulator/TelescopeHardware.cs(1517,42): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.211 /app/TelescopeSimulator/TelescopeHardware.cs(1670,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.212 /app/TelescopeSimulator/TelescopeHardware.cs(1786,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.212 /app/TelescopeSimulator/TelescopeHardware.cs(1843,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.212 /app/TelescopeSimulator/TelescopeHardware.cs(1933,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.212 /app/TelescopeSimulator/TelescopeHardware.cs(158,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.213 /app/TelescopeSimulator/TelescopeHardware.cs(163,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.213 /app/TelescopeSimulator/TelescopeHardware.cs(168,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.214 /app/TelescopeSimulator/TelescopeHardware.cs(173,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.214 /app/TelescopeSimulator/TelescopeHardware.cs(193,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.214 /app/TelescopeSimulator/TelescopeHardware.cs(200,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.215 /app/TelescopeSimulator/TelescopeHardware.cs(202,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.215 /app/TelescopeSimulator/TelescopeHardware.cs(219,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.215 /app/TelescopeSimulator/TelescopeHardware.cs(224,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.216 /app/TelescopeSimulator/TelescopeHardware.cs(249,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.216 /app/TelescopeSimulator/TelescopeHardware.cs(254,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.216 /app/TelescopeSimulator/TelescopeHardware.cs(265,23): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.217 /app/TelescopeSimulator/TelescopeHardware.cs(274,23): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.217 /app/TelescopeSimulator/TelescopeHardware.cs(279,23): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]

Could anyone provide me with any pointers to be able to solve this niggling issue?任何人都可以为我提供任何能够解决这个琐碎问题的指示吗?

My suspicions are that it has something to do with the nested WindowsBase.Vector situation...我怀疑它与嵌套的WindowsBase.Vector情况有关......

Your mistake is that you never copy the code for the WindowsBase.Vector project into the container.您的错误是您从未将 WindowsBase.Vector 项目的代码复制到容器中。 Add the last line in this block.在此块中添加最后一行。

# copy everything else and build app
COPY ASCOM.Alpaca.Simulators/. ./ASCOM.Alpaca.Simulators/
COPY Camera.Simulator/. ./Camera.Simulator/
COPY CoverCalibratorSimulator/. ./CoverCalibratorSimulator/
COPY DomeSimulator/. ./DomeSimulator/ 
COPY FilterWheelSimulator/. ./FilterWheelSimulator/ 
COPY FocuserSimulator/. ./FocuserSimulator/ 
COPY ObservingConditionsSimulator/. ./ObservingConditionsSimulator/ 
COPY OmniSim.Tools/. ./OmniSim.Tools/ 
COPY RotatorSimulator/. ./RotatorSimulator/ 
COPY SafetyMonitorSimulator/. ./SafetyMonitorSimulator/ 
COPY SwitchSimulator/. ./SwitchSimulator/ 
COPY TelescopeSimulator/. ./TelescopeSimulator/ 
COPY WindowsBase.Vector/. ./WindowsBase.Vector/

but instead of copying each project separately, you can just do但不是单独复制每个项目,你可以这样做

# copy everything else and build app
COPY . .

and copy everything at once.并立即复制所有内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM