dotnet / dotnet/winforms

VS 2026: Winforms designer (net9) doesn't release bin dll on rebuild

Open
#13,974 5 comments 0 reactions 1 assignee Claimed by @Shyam-Gupta View on GitHub
area-VSDesigner
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

### Environment

VS Version: Insiders [11111.16]

### .NET version

.net core 9

### Did this work in a previous version of Visual Studio and/or previous .NET release?

i don't remember having these problems last time i touched this project in VS2022 about a year ago, but i'm not sure there.

### Issue description

when designing a component the out-of-process winforms designer opens and locks the dll file the component's base type is in. but sadly, it doesn't release that assembly on build. so i cannot compile because i get lots of these errors:

> 1>C:\Program Files\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4903,5): warning MSB3026: Could not copy "obj\Debug\net9.0\Bipro_V2_9_3.dll" to "bin\Debug\net9.0\Bipro_V2_9_3.dll". Beginning retry 3 in 1000ms. The process cannot access the file 'bin\Debug\net9.0\Bipro_V2_9_3.dll' because it is being used by another process. The file is locked by: "DesignToolsServer (21796)"

this only goes away when closing and reopening VS (i didn't dare to kill the DesignToolsServer process alone, yet)

this hurts when using visual inheritance
This needs to be fixed before VS2026 RTMs, or you get soooo many error tickets.

### Steps to reproduce

create a .net 9 winforms app
create a usercontrol A
create a usercontrol B deriving from it
open UserControl A in the designer, modify it and save
open usercontorl B in the designer, modify it
try to rebuild.

### Diagnostics

```text
1>C:\Program Files\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4903,5): warning MSB3026: Could not copy "obj\Debug\net9.0\Bipro_V2_9_3.dll" to "bin\Debug\net9.0\Bipro_V2_9_3.dll". Beginning retry 3 in 1000ms. The process cannot access the file 'bin\Debug\net9.0\Bipro_V2_9_3.dll' because it is being used by another process. The file is locked by: "DesignToolsServer (21796)"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.