I'm getting the following error:
C:\Program Files\dotnet\sdk\2.0.3\Microsoft.Common.CurrentVersion.targets(4052,5): warning MSB3026: Could not copy "obj\Debug\netcoreapp2.0\MyApp.dll" to "bin\Debug\netcoreapp2.0\MyApp.dll". Beginning retry 1 in 1000ms. The process cannot access the file 'C:\stackoverflow\MyApp\bin\Debug\netcoreapp2.0\MyApp.dll' because it is being used by another process. [C:\stackoverflow\MyApp\MyApp.csproj]
When trying to use dotnet run
multiple times on the same project from different terminals. How do you easily run multiple instances of the same app while developing, without having to copy the folder?
If I start both at exactly the same time, it sometimes works :/
I've used bat file to run 6 instances of app in one time. Only problem was when I started build of application and immediately run script. So I think you should make sure that build process ended. And then run you bat file with for example dotnet run repeated six times. Your app should be built to execute this file.
start /d "." dotnet run args
start /d "." dotnet run args
start /d "." dotnet run args
start /d "." dotnet run args
start /d "." dotnet run args
start /d "." dotnet run args
I had the same problem and solved it using --no-build option:
dotnet run --no-build <path to .dll> <args>
Please take a look at: MSDN documentation
The best thing in development time I've found is dotnet watch commandline tool.
You could have one bat file which will start multiple dotnet watch run <project>
commands like in MateuszWkDev's answer.
Running in watch mode doesn't blocks files from editing and will rebuild and rerun applications once you'll edit your source files automatically.
Suppose you have bat file in src
folder which has SomeProject, OtherProject and YetAnotherProject folders, which are contains csproj-files. Then bat file could looks like:
start /d "%~dp0\SomeProject" dotnet watch run SomeProject
start /d "%~dp0\OtherProject" dotnet watch run OtherProject
start /d "%~dp0\YetAnotherProject" dotnet watch run YetAnotherProject
Once you run this bat file, you'll got three terminals running dotnet watch run <project>
commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With