Cannot run tests while ASP.Net Core project is running: "Unable to copy file"

When I try to run tests for my ASP.Net Core project in Rider 2019.1.2, if the project is running at the moment, I receive an error:

Microsoft.Common.CurrentVersion.targets(4195, 5): [MSB3021] Unable to copy file "obj\Debug\netcoreapp2.2\SportsStore.dll" to "bin\Debug\netcoreapp2.2\SportsStore.dll". The process cannot access the file 'D:\Coding\CSharp\Learn\SportsStore\SportsStore\bin\Debug\netcoreapp2.2\SportsStore.dll' because it is being used by another process.

Steps to reproduce the problem:

1. Run an Asp.Net project;

2. Change some code in the project;

3. Run tests. Expect to see them running, in reality you will get an error.

It is very inconvenient to constantly switch between running tests and running a project to visually see my changes in the browser. Please, help!

0
3 comments

Hello!

Does your project contain some autogenerated code?
Also, please clarify your Rider version and collect logs after reproducing the issue (Help | Compress Logs and Show in...). You can attach logs to https://youtrack.jetbrains.com/issue/RIDER-26131.

 

Can you reproduce the problem on a simple project?

0

My project contained an autogenerated migration, but I reproduced the problem on a simple project without it: https://github.com/StragaSevera/RiderBug

Attached logs to the link above.

0

By the way, according to the Process Explorer, the process that prevents a dll from being copied to is winpty-agent.exe :

0

Please sign in to leave a comment.