This gist demonstrates a problem experienced when using dotnet run
within a docker container.
The command works fine outside of the container, but when running the container we run into a problem wherein
NuGet references cannot be resolved outside of the container, so vscode or visual studio will report problems
if you start the compose project.
To test this out, copy the files to your computer in a new directory. Open the directory with either editor
(vscode or vs). Run the following comand and observe the errors in your editor that appear at the
using PSValueWildcard;
statement in Program.cs
.
docker build . -t docker-dotnet-watch && docker run -v .:/src docker-dotnet-watch
https://natemcmaster.com/blog/2018/05/12/dotnet-watch-2.1/#support-for-running-in-docker
The solution is to add the following
Directory.Build.props
file to the project or solution directory.