c# – Visual Studio 2022 with publish Docker and local NuGets


my situation is that I have a solution with 3 Projects:
A: Starter as Console App
B: Starter as Webservice aspnet.core und swagger should run later within a docker image
C: Modul Lib (this one requires a bunch of NuGets that where hosted on my dev machine and on two unc paths within the network)

Any Build of A + C works fine
B+C against local Docker:

  • Any buildtype like DEBUG to container works fine. Build, create and start docker no issue
  • Any buildtype like RELEASE fails against docker, but IIS, http works fine.
    B+C with publish as docker:
    Option a SDK: Build run through without any problem, but don’t know where the image is. In Docker for Windows it don’t appears nor publish target
    Option b Docker: Build fails, can’t find the mentioned local NuGet.

Also facing the problem that VS don’t copy the context/meta stuff from user to the build folder. I copy that manulley when the message appears, then its gone.
I tried every approch I found e.g. copying the nuget.config to the image (as lower case) then bind it by –configfile behind RUN dotnet restore xxx.csproj. It looks like that the build runs within the container, that would explain NU1102,1101 etc.

I have 2 ideas:
a) create a app that does similare to dotnet restore and parses the .csproj’s for local nuget and copy them to folders and copy them to the container before build
b) create a app to publish my local nuget to a devops nuget feed and run the –configfile with the nuget.org and my devops feed

Some had a solution for that problem or other approches??

kind regards 🙂

Leave a Reply

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