'Getting CS0246 error but code compiles and runs just fine
I currently have one solution with two child projects, one of them is a .net class library. The library is written in f# and the other project in c#. As you can see below, I've connected them using namespaces.
The C# code:
using System;
using testLibrary;
public class example : testType
{
}
The F# code:
namespace testLibrary
type testType() =
// you get the idea
In visual studio, I added the f# project as a dependency of the c# project and when I build, everything behaves as expected. I also don't get any errors in visual studio. However, I open the same project in visual studio code and I get a big red editor warning:
The type or namespace name 'testLibrary' could not be found (are you missing a using directive or an assembly reference?) [ProjectName]csharp(CS0246)
The code still runs fine, but the big error warning is really annoying and could get in the way later. Since it works fine, I don't care if I need to resolve the error somehow or just find some way for vscode to ignore it, but I would appreciate if someone could tell me how to make this error go away. Some things I've already checked/tried:
#pragma warning disableseems to do nothing even when placed at line 1- both projects are targeting net6.0 and pull from the same sdk
- I've set
<NoWarn>under the csproj file - I have rebuilt the projects/solution in any order I could think of
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
