C
C#•2y ago
no >> body

dotnet restore to ignore packages

I have several projects in my solution: 1. Web API 2. Worker service 3. Application layer and many others Web API and Wonder service have a reference to the application layer. The application layer project contains dependencies from an external package source, which I use only with the Worker service. Now I need to create a docker image for WebAPI, and to do that, I need to call 'dotnet restore' in my Dockerfile. Is it possible to ignore packages from external package sources if I don't need them in the project I want to build? Because now, to build an image, I need to provide a key for the NuGet source, which I will not use with WebAPI.
1 Reply
undisputed world champions
i guess you want to extract the application layer stuff, that is only used in the worker service, into it's own project (ApplicationLayer.Worker or similar) than you don't need to reference it in the web api project 😉