microsoft / dotnet

This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.
https://devblogs.microsoft.com/dotnet/
MIT License
14.31k stars 2.21k forks source link

My WPF project has a namespace error #1361

Closed 344089386 closed 1 year ago

344089386 commented 1 year ago

Error Tip: No type or namespace name "Windows" in namespace "test.wpf.system" (missing assembly reference?)

This error occurs when my project contains the System namespace. I predict this is due to the implicit namespaces of.net6. I tried <DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports> and <Using Remove="XXX.System" /> but it didn't work.

image

Repeat steps: build project

Error Code: https://github.com/344089386/WpfTest

RussKie commented 1 year ago

Please raise WPF-related issues in https://github.com/dotnet/wpf.

I tried <DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports> and <Using Remove="XXX.System" /> but it didn't work.

This is not how implicit usings are enabled or disabled, refer to https://learn.microsoft.com/dotnet/core/project-sdk/msbuild-props#implicitusings.

No type or namespace name "Windows" in namespace "test.wpf.system" (missing assembly reference?)

WPF (and other defaults) usings are described here: https://learn.microsoft.com/dotnet/core/project-sdk/overview#implicit-using-directives

RussKie commented 1 year ago

/cc: @singhashish-wpf