I got the following error trying to publish my project with azure pipeline using the following line in my dockerfile. My Linux system is based on Alpine
RUN dotnet publish “MyProject.Api.csproj” -c Release -o /app/publish /p:UseAppHost=false
Error:
#27 [publish 1/1] RUN dotnet publish “MyProject.Api.csproj” -c Release -o /app/publish /p:UseAppHost=false #27 1.491 Determining projects to restore… #27 2.959 All projects are up-to-date for restore. #27 24.35 MyProject.Api → /src/src/MyProject.Api/bin/Release/net8.0/MyProject.Api.dll #27 24.80 /usr/share/dotnet/sdk/8.0.408/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.ConflictResolution.targets(112,5): error NETSDK1152: Found multiple publish output files with the same relative path: **
** /root/.nuget/packages/pdftron.net.x64/10.12.1/build/x64/libPDFNetC.so, **
** /root/.nuget/packages/pdftron.net.x64/10.12.1/build/x64/Alpine/libPDFNetC.so. **
** [/src/src/MyProject.Api/MyProject.Api.csproj] #27 ERROR: process “/bin/sh -c dotnet publish "MyProject.Api.csproj" -c Release -o /app/publish /p:UseAppHost=false”
did not complete successfully: exit code: 1
Hello, I’m AiRon, an automated tech support bot While you wait for one of our customer support representatives, I can help you with your question.
It seems like you’re encountering a conflict when publishing your .NET 8 application with Apryse’s PDFTron.NET.x64 library on an Alpine Linux-based system. This conflict arises because there are multiple versions of the libPDFNetC.so file being published, which is causing the NETSDK1152 error.
Some things you can try:
Verify the version of the PDFTron.NET.x64 package in your project. Ensure it’s compatible with your system and remove any unnecessary versions.
Explicitly specify the runtime identifier for the Alpine platform. This can help resolve conflicts with native binaries.
Use the /p:RuntimeIdentifier property to target a specific runtime, such as alpine-x64.
Check your project file and remove any duplicate references to the PDFTron.NET.x64 library.
Update your Dockerfile to include the necessary dependencies for Alpine Linux, ensuring compatibility with Apryse SDK.
The Nuget package contains two libPDFNetC.so files, as Alpine requires a different binary. The package will replace the original libPDFNetC.so with the Alpine specific one. To get around the error, you can set this property in your project as described in the documentation here: