C
C#ā€¢15mo ago
.orionpax

ā” Publishing to DigitalOcean app platform: Does not restore test projects, still tries to build them

Hi there. I have an ASP.NET Core (dotnet 6 currently) application that I want to deploy to Digital Ocean. They do not support dotnet natively, so a dockerfile is needed. I copied one from the web that does a multi-stage build and optimize that worked when I ran it manually on a Linux droplet (also on DO). However, when I start the deployment process, it fails on the build. My project consists of the app itself, three class libraries with supporting functionality, and two test projects. Once the Dockerfile has copied things into place, it runs dotnet restore on the main project - which of course references the three class libraries, so any Nuget packages they depend on are also restored. However, nothing refers to the test projects of course (the test projects refer to the class libraries and main web api project), so they are not restored - as expected. But when Docker gets to the dotnet build part, it seems to also want to build the test projects. However, since xunit and other dependencies have not been restored, this gives hundereds of errors such as this: error CS0246: The type or namespace name 'Xunit' could not be found (are you missing a using directive or an assembly reference?) Now, I don't really care one way or another - if the solution is to get the test projects to be restored before build, or if it is to "force" the build to stay away from the test projects doesn't really matter to me - as long as I get it building. Anyone know what to do to fix this behaviour? I can understand why it happens, but I want to get past it to get the web app deployed of course. šŸ™‚ Thanks for any insights!
1 Reply
Accord
Accordā€¢15mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.