Reputation: 6222
I'm trying to use dotnet watch however my project references nuget package which uses $(SolutionDir) to copy some files in prebuild event. It kinda make sense because dotnet watch is run on project level so $(SolutionDir) doesn't exist. Is there any way to run dotnet watch for entire solution?
Upvotes: 2
Views: 2270
Reputation: 6222
I created a batch script watch.bat
call SET ASPNETCORE_ENVIRONMENT=Development
call SET SolutionDir=%~dp0\\..\\..\\
call dotnet watch run
Added a script in package.json
:
"scripts": { "dotnetwatch": "watch.bat" }
Now I can run it like this from CLI:
npm run dotnetwatch
or from within visual studio with the following launchsettings.json
profile:
"dotnet watch": {
"executablePath": "watch",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
It's not an ideal solution but at least it's good enough for me.
Upvotes: 2
Reputation: 26763
As of dotnet-watch 2.0.0-preview2, it is not possible to run dotnet watch on solution files. However, you can construct a custom 'project' for the watcher that will watch multiple projects. See https://github.com/aspnet/DotNetTools/tree/rel/2.0.0-preview2/samples/dotnet-watch/WatchMultipleProjects for a complete sample of how to do this.
Upvotes: -1