So I have an ASP.NET project in a folder (src
) and a test project in a folder right next to the other folder (tests
). What I am trying to achieve is to be able to run my tests and deploy the application using docker, however I am really stuck.
Right now there is a Dockerfile in the src
folder, which builds the application and deploys it just fine. There is also a Dockerfile for the test project in the tests
folder, which should just run my tests.
The tests/Dockerfile
currently looks like this:
FROM microsoft/dotnet:2.2.103-sdk AS build
WORKDIR /tests
COPY ["tests.csproj", "Tests/"]
RUN dotnet restore "Tests/tests.csproj"
WORKDIR /tests/Tests
COPY . .
RUN dotnet test
But if i run docker build, the tests fail, I am guessing because the application's code to be tested is missing. I am getting a lot of:
The type or namespace name 'MyService' could not be found (are you missing a using directive or an assembly reference?
I do have a projectreference in my .csproj file so what could be the problem?