I’m working on a WPF project in Visual Studio Code, targeting .NET Framework 4.7.2. I’m using csc.exe
and msbuild.exe
from C:WindowsMicrosoft.NETFramework64v4.0.30319
. However, I’m encountering persistent errors in VS Code:
[Warn] [LanguageServerProjectSystem] Project c:pathtoMyProject.csproj has unresolved dependencies
[Warn] [LanguageServerProjectSystem] Warning while loading c:pathtoMyProject.csproj: Unknown build error, 'Object reference not set to an instance of an object.'
To reproduce the error:
git clone https://github.com/MinimalWindowsDev/Industrial-WPF-HMI-Template
cd Industrial-WPF-HMI-Template
git checkout 0463c0b69dcc16cc56b0b766857d2f72e99ac014
code .
Interestingly, the project builds successfully when I run msbuild
from the command line.
What I’ve tried:
- Cleaned and rebuilt the project
- Deleted
bin
andobj
folders - Restarted OmniSharp
- Updated the C# extension
- Checked all references in the
.csproj
file
My questions:
- What might be causing this discrepancy between VS Code and command-line builds?
- How can I further diagnose this “unresolved dependencies” error?
- Are there any known issues with the C# extension for WPF projects using .NET Framework (not .NET Core)?
Any insights or troubleshooting steps would be greatly appreciated!