簡體   English   中英

ASP.NET 核心對接嵌套項目

[英]ASP.NET core dockerising a nested project

所以,我最近遇到了一個我想在 do.net 中構建的 dockerise 項目(我應該警告我不是 .net 開發人員)

可以在此處找到回購以供參考:

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

我已盡最大努力設置以下 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"]

但是,我遇到以下錯誤堆棧:

#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]

任何人都可以為我提供任何能夠解決這個瑣碎問題的指示嗎?

我懷疑它與嵌套的WindowsBase.Vector情況有關......

您的錯誤是您從未將 WindowsBase.Vector 項目的代碼復制到容器中。 在此塊中添加最后一行。

# 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/

但不是單獨復制每個項目,你可以這樣做

# copy everything else and build app
COPY . .

並立即復制所有內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM