Closed kant2002 closed 2 years ago
[15:46:48.427389] info: [SampleWindowsForms]: Unhandled exception. System.TypeInitializationException: The type initializer for 'Microsoft.VisualStudio.WinForms.Server.WinFormsDesignTimeAssemblies' threw an exception. [15:46:48.427389] info: [SampleWindowsForms]: ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified. [15:46:48.427389] info: [SampleWindowsForms]: File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Are you referencing .NET Framework in a .NET project?
No, I do not. And I do not even have Net Frmaeowkr TFM anywhere
I think this is the same for canary builds so https://github.com/dotnet/winforms/issues/7182#issuecomment-1132362956 applies
Yes, I very much suspect so. You're trying to load a Windows Forms project in the designer that's using the globally installed .NET Windows Desktop SDK, and the project is referencing the canary bits of the Windows Desktop SDK from another place...
Not sure how complicated it would be, but if Designer just log message if detect System.Windows.forms.dll inside bin folder. At least that reduce noise which I can make in the future (and any contributor)
Then we'd have to know the content of the Windows Desktop SDK so we can match any file from it... And what if someone (because why not?) decides to name their assembly System.Windows.Forms.dll? Unless the dll has the same identity, it shouldn't really be a problem.... Though I'm not 100% sure :)
Environment
17.3.0 Preview 1.0
.NET version
.NET 7.0
Did this work in a previous version of Visual Studio and/or previous .NET release?
No response
Issue description
I open project and almost immidiately open MainForm in the designer. It sits in the loading process. Log below.
Steps to reproduce
I open https://github.com/kant2002/WinFormsComInterop project Change inside
Directory.Build.props
UseNet7
to TrueWinFormsRepoRoot
to path to locally build WinForms.Diagnostics
No response