You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dotnet test result an error CS0579: Duplicate 'System.Reflection.AssemblyCompanyAttribute'
Hi,
When building my project under Azure Devops yaml pipeline, if I launch unit test in my Dockerfile, I get the following : error CS0579: Duplicate 'System.Reflection.AssemblyCompanyAttribute'
General
The project is like organised this way
So my Unit test (xUnit) project is under tests folder of my main project within the same repository.
My Dockerfile used for my CICD is
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["ITF.Microservices.Ordering.csproj", "ITF.Microservices.Ordering/"]
COPY NuGet.config "ITF.Microservices.Ordering/"
RUN dotnet restore "ITF.Microservices.Ordering/ITF.Microservices.Ordering.csproj"
WORKDIR "src/ITF.Microservices.Ordering"
COPY . .
RUN dotnet build "ITF.Microservices.Ordering.csproj" -c Release -o /app/build
RUN dotnet test "tests/ITF.Microservices.Ordering.UnitTests/ITF.Microservices.Ordering.UnitTests.csproj" -c Release --logger "trx;LogFileName=testresults.trx"
FROM build AS publish
RUN dotnet publish "ITF.Microservices.Ordering.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ITF.Microservices.Ordering.dll"]
I both ITF.Microservices.Ordering.csproj and ITF.Microservices.Ordering.UnitTests.csproj I added the following to get rid of Duplicate errors.
The pipeline does build and publish the release correctly, but when I require dotnet test instruction from the Dockerfile, the tests are played and published
But it ended with an error
Full error line here obj/Release/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs(4,12): error CS0579: Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute [/src/src/ITF.Microservices.Ordering/ITF.Microservices.Ordering.csproj]
When I remove the dotnet test from the Dockerfile instruction, everything works fine
dotnet test result an error CS0579: Duplicate 'System.Reflection.AssemblyCompanyAttribute'
Hi,
When building my project under Azure Devops yaml pipeline, if I launch unit test in my Dockerfile, I get the following :
error CS0579: Duplicate 'System.Reflection.AssemblyCompanyAttribute'
General
The project is like organised this way
So my Unit test (xUnit) project is under tests folder of my main project within the same repository.
My Dockerfile used for my CICD is
I both ITF.Microservices.Ordering.csproj and ITF.Microservices.Ordering.UnitTests.csproj I added the following to get rid of Duplicate errors.
Under Azure Devops I use the following pipeline
And the following build_deploy.yml template
The pipeline does build and publish the release correctly, but when I require dotnet test instruction from the Dockerfile, the tests are played and published
But it ended with an error
Full error line here
obj/Release/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs(4,12): error CS0579: Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute [/src/src/ITF.Microservices.Ordering/ITF.Microservices.Ordering.csproj]
When I remove the dotnet test from the Dockerfile instruction, everything works fine
Some people seem to face the same problem as me
https://stackoverflow.com/a/62021598/4734707
The text was updated successfully, but these errors were encountered: