Dotnet Core Build Error in Docker: Resource file “**/*.resx” cannot be found

While building my new .NET Core project using Docker I ran into an error with the two stage build:

/usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(2924,5): error MSB3552: Resource file “**/*.resx” cannot be found. [/Hapthorn.csproj]
The command ‘/bin/sh -c dotnet publish -c Release -o out’ returned a non-zero code: 1

The problem it turned out was that while trying to tune my Dockerfile I’d accidentally removed the WORKDIR directive. As a result MSBuild was interpreting the *.resx as an absolute path instead of a grouping/collection directive.

To fix it I put back in a WORKDIR /src directive in my Dockerfile.

Quick and easy!

Leave a Reply

Your email address will not be published. Required fields are marked *