0

I am using .NET 6.0 SDK to register an instance via MSBuildLocator in Roslyn. According to MSBuildLocator.IsRegistered the instance is registered and returns true. Locally everything works perfect and when I load external projects (that target .NET 6, 5 or even .NET Core 3.1) and read the symbols, the full namespace is returned correctly. However, when I run it on a Docker container it is not returning the full namespace. The internal namespaces that are referenced within a project are good but not those that are external e.g. Microsoft.AspNetCore.Mvc.ControllerBase.

This is the Dockerfile.

# Set the base image as the .NET 6.0 SDK (this includes the runtime)
FROM mcr.microsoft.com/dotnet/sdk:6.0 as build-env

# Copy everything and publish the release (publish implicitly restores and builds)
WORKDIR /app
COPY . ./
RUN dotnet publish ./ -c Release -o out --no-self-contained

# Relayer the .NET SDK, anew with the build output
FROM mcr.microsoft.com/dotnet/sdk:6.0
COPY --from=build-env /app/out .
ENTRYPOINT [ "dotnet", "/RoslynApplication.dll" ] 

Note: I also change the TargetFramework of my RoslynApplication accordingly when creating Docker images. Also the Workspace.Diagnostics does not return any error.

Anyone has an idea why locally they are loaded correctly whereas on Docker container not? I tried to also add SDK 6.0 and SDK 5.0 to Docker container and then Register as an instance the SDK 5.0 for projects that are targetting that framework but still did not work.

ce8
  • 23
  • 1
  • 3

0 Answers0