Skip to content

WinformsDesigner copied all references for multitarget project (including DLLs from wrong target) #12454

Open

Description

Environment

Version 17.10.6

.NET version

Multitarget: net8;net472

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

No

Issue description

When we're using multitarget project, that one is reference on another multitargeted project, winforms designer copies references into cache for both targets, causing often not working mix. If you're checking cache after that, there would be artefacts from previous target, like System.Memory.dll in my example

[23:00:43.040536] info: [Thread 485] Launching server...
[23:00:43.341536] info: Shadow cache base directory: C:\Users\XXX\AppData\Local\Microsoft\VisualStudio\17.0_d57e068e\WinFormsDesigner
[23:00:43.342536] info: [WinFormsApp3]: Preparing shadow cache folder.
[23:00:43.342536] info: [WinFormsApp3]: NetCoreServerLayout - Platform: AnyCPU, Normalized PlatformName: x64
[23:00:43.342536] info: [WinFormsApp3]: Copying design tools server common files from: 'c:\program files\microsoft visual studio\2022\professional\common7\ide\commonextensions\microsoft\windows.forms\DesignToolsServer\Common'.
[23:00:43.421536] info: [WinFormsApp3]: Copying design tool server platform-specific files from: 'c:\program files\microsoft visual studio\2022\professional\common7\ide\commonextensions\microsoft\windows.forms\DesignToolsServer\x64'.
[23:00:43.431536] info: [WinFormsApp3]: Copying project output file: 'C:!!!Projects\Test\WinFormsApp3\bin\Debug**\net8.0-windows**\WinFormsApp3.dll'.
[23:00:43.433537] info: [WinFormsApp3]: Copying project reference: 'c:\views!nuget\PackagesCache\system.buffers\4.5.1\lib*net461*\System.Buffers.dll'.
[23:00:43.435536] info: [WinFormsApp3]: Copying project reference: 'c:\views!nuget\PackagesCache\system.memory\4.5.5\lib**\net461*System.Memory.dll'.
[23:00:43.436538] info: [WinFormsApp3]: Copying project reference: 'c:\views!nuget\PackagesCache\system.numerics.vectors\4.5.0\lib\net46\System.Numerics.Vectors.dll'.
[23:00:43.438536] info: [WinFormsApp3]: Copying project reference: 'c:\views!nuget\PackagesCache\system.runtime.compilerservices.unsafe\4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll'.
[23:00:43.439537] info: [WinFormsApp3]: Copying project reference: 'C:!!!Projects\Test\ClassLibrary3\bin\Debug*net472\ClassLibrary3.dll
'.
[23:00:43.440536] info: [WinFormsApp3]: Copying 'C:!!!Projects\Test\WinFormsApp3\obj\Debug\net8.0-windows\WinFormsApp3.designer.deps.json' to 'DesignToolsServer.deps.json'
[23:00:43.442538] info: [WinFormsApp3]: Copying 'C:!!!Projects\Test\WinFormsApp3\obj\Debug\net8.0-windows\WinFormsApp3.designer.runtimeconfig.json' to 'DesignToolsServer.runtimeconfig.json'
[23:00:43.443538] info: [WinFormsApp3]: Copying project reference: 'C:!!!Projects\Test\ClassLibrary3\bin\Debug**\net8.0\ClassLibrary3.dll**'.
[23:00:43.479537] info: Shadow caching completed.

Steps to reproduce

  1. Create 2 projects (WinFormsApp and ClassLibrary), both with multitarget, say net8-windows and net472.
  2. Let's project ClassLibrary is dll, with reference on net472 specific stuff (say, System.Memory package. there is no files there for net8)
  3. Project WinFormsApp is using winforms and reference on project ClassLibrary
  4. Open designer and check cache folder. There would be dependencies from net472 targeted project, albeit project WinFormsApp and ClassLibrary dlls is targeted to net8.winforms-multitarget.zip

Diagnostics

[23:00:43.342536] info: [WinFormsApp3]: Preparing shadow cache folder.
[23:00:43.342536] info: [WinFormsApp3]: NetCoreServerLayout - Platform: AnyCPU, Normalized PlatformName: x64
[23:00:43.342536] info: [WinFormsApp3]: Copying design tools server common files from: 'c:\program files\microsoft visual studio\2022\professional\common7\ide\commonextensions\microsoft\windows.forms\DesignToolsServer\Common'.
[23:00:43.421536] info: [WinFormsApp3]: Copying design tool server platform-specific files from: 'c:\program files\microsoft visual studio\2022\professional\common7\ide\commonextensions\microsoft\windows.forms\DesignToolsServer\x64'.
[23:00:43.431536] info: [WinFormsApp3]: Copying project output file: 'C:\!!!Projects\Test\WinFormsApp3\bin\Debug\net8.0-windows\WinFormsApp3.dll'.
[23:00:43.433537] info: [WinFormsApp3]: Copying project reference: 'c:\views\!nuget\PackagesCache\system.buffers\4.5.1\lib\net461\System.Buffers.dll'.
[23:00:43.435536] info: [WinFormsApp3]: Copying project reference: 'c:\views\!nuget\PackagesCache\system.memory\4.5.5\lib\net461\System.Memory.dll'.
[23:00:43.436538] info: [WinFormsApp3]: Copying project reference: 'c:\views\!nuget\PackagesCache\system.numerics.vectors\4.5.0\lib\net46\System.Numerics.Vectors.dll'.
[23:00:43.438536] info: [WinFormsApp3]: Copying project reference: 'c:\views\!nuget\PackagesCache\system.runtime.compilerservices.unsafe\4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll'.
[23:00:43.439537] info: [WinFormsApp3]: Copying project reference: 'C:\!!!Projects\Test\ClassLibrary3\bin\Debug\net472\ClassLibrary3.dll'.
[23:00:43.440536] info: [WinFormsApp3]: Copying 'C:\!!!Projects\Test\WinFormsApp3\obj\Debug\net8.0-windows\WinFormsApp3.designer.deps.json' to 'DesignToolsServer.deps.json'
[23:00:43.442538] info: [WinFormsApp3]: Copying 'C:\!!!Projects\Test\WinFormsApp3\obj\Debug\net8.0-windows\WinFormsApp3.designer.runtimeconfig.json' to 'DesignToolsServer.runtimeconfig.json'
[23:00:43.443538] info: [WinFormsApp3]: Copying project reference: 'C:\!!!Projects\Test\ClassLibrary3\bin\Debug\net8.0\ClassLibrary3.dll'.
[23:00:43.479537] info: Shadow caching completed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

area-VSDesignerWindows Forms out-of-proc designer related issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions