dotnet format 7.0.304 fails when resolving types from COM references
See original GitHub issueDescribe the bug
dotnet format cannot resolve types from COM references
To Reproduce
A trivial test project is available here:
https://github.com/molesmoke/WinFormsAppDotNetFormat
Exceptions (if any)
error CS0246: The type or namespace name 'SpVoice' could not be found (are you missing a using directive or an assembly reference?)
Further technical details
- Include the output of
dotnet --info
.NET SDK: Version: 7.0.304 Commit: 7e794e2806
Runtime Environment: OS Name: Windows OS Version: 10.0.22621 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.304\
Host: Version: 7.0.7 Architecture: x64 Commit: 5b20af47d9
.NET SDKs installed: 6.0.401 [C:\Program Files\dotnet\sdk] 6.0.402 [C:\Program Files\dotnet\sdk] 6.0.410 [C:\Program Files\dotnet\sdk] 7.0.304 [C:\Program Files\dotnet\sdk] 7.0.400-preview.23274.1 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables: Not set
global.json file: C:\Users\jerem\source\repos\tests\WinFormsAppDotNetFormat\global.json
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download
- The IDE (VS / VS Code/ VS4Mac) you’re running on, and its version
Build Tools & VS Pro 17.6.3
Issue Analytics
- State:
- Created 3 months ago
- Reactions:3
- Comments:25 (12 by maintainers)
Top GitHub Comments
I’m not sure how/why 7.0.107 worked for this. COMReference isn’t supported for the
dotnet
tool, which includesdotnet format
. https://github.com/dotnet/msbuild/issues/3986The tracking issue for this is https://github.com/dotnet/roslyn/issues/47384.
This is also covered in the issue above, e.g. comment https://github.com/dotnet/roslyn/issues/47384#issuecomment-1010270932.