Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
svg2003 opened this issue Nov 9, 2024 · 2 comments
Labels
area-VSDesigner Windows Forms out-of-proc designer related issues

Comments

@svg2003
Copy link

svg2003 commented Nov 9, 2024

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.
@svg2003 svg2003 added the untriaged The team needs to look at this issue in the next triage label Nov 9, 2024
@elachlan elachlan added the area-VSDesigner Windows Forms out-of-proc designer related issues label Nov 9, 2024
@merriemcgaw
Copy link
Member

@Zheng-Li01 can you check to see if we have anything in the internal repo about this and repro it on your end?

@merriemcgaw merriemcgaw removed the untriaged The team needs to look at this issue in the next triage label Nov 12, 2024
@Zheng-Li01
Copy link
Member

@merriemcgaw, found the similar issue 4418 in the internal repo.

@Zheng-Li01 Zheng-Li01 removed their assignment Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-VSDesigner Windows Forms out-of-proc designer related issues
Projects
None yet
Development

No branches or pull requests

4 participants