Click here to Skip to main content
15,908,115 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am revising a .Net FW4 project in order to add some WPF components (in net 6). In the revised .csproj,I added the 2 lines in the <propertygroup>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="">

Then in the .cs file, I added
using System.Windows.Controls; 

However, I got error, such as
CS0234: The type or namespace name does not exist in the namespace (are you missing an assembly reference?)

How to fix it? Thanks.

What I have tried:

CS0234: The type or namespace name does not exist ...
s yu 3-May-24 8:09am    
I re-added a new class-library type Project into the solution, the namespace can be recognized. Before, the project type created was an ArcGIS Pro Managed Configuration, which causes the Error CS0234. Thanks to Dave and Richard for your responses.

You most likely don't have a reference to PresentationFramework.dll set in your project.
Share this answer
s yu 23-Apr-24 13:35pm    
True. When I tried to check on the PresentationFramework.dll, I got error "The project configuration 'DebugAndCPU' was not found in the project manifest. How to resolve it? Thanks.
Dave Kreskowiak 23-Apr-24 16:29pm    
First, I would NEVER just edit a csproj file to change from a .NET Framework project to a .NET core project. I'd make an entirely new project and copy whatever source files I need over to the new project.

The project formats between .NET Framework and .NET (Core) are very different.

s yu 24-Apr-24 13:24pm    
Actually, I also tried what you said. But I got another bug
Dave Kreskowiak 24-Apr-24 14:32pm    
I already said what I needed to say over there, and I wouldn't have anything else to say over and above what Oringal Griff has already said.
As Dave said, it's not as simple as changing the target framework and adding the UseWpf item; the project format has changed quite significantly.

Undo your changes, and use the CsprojToVs2017[^] command-line tool to update your project file to the newer format.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900