C#: type or namespace name 'InternalsVisibleTo' could not be found
Date: 2020-12-26 | csharp | troubleshoot |
Overview
I'm trying to make it so my dotnet core test project can test the internals of my source project. To do that I'm using the InternalsVisibleTo
attribute. However when I try to compile I'm getting the error:
error CS0246: The type or namespace name 'InternalsVisibleTo' could not be found
How do I fix this?
Solution
Typically errors like this mean you're missing an import of some sort. I was able to fix this by adding this import line at the top of my file:
using System.Runtime.CompilerServices;
Want more like this?
The best / easiest way to support my work is by subscribing for future updates and sharing with your network.