1 year ago

#365794

test-img

Ethan Gray

Error CS0116 occurring on macOS Big Sur but not Windows 11 in Visual Studio Community 2022

I'm working on a school project with one of my classmates. I'm on windows 11 and they're using macOS Big Sur. Everything works on my laptop and desktop that are both running windows. However, as soon as my classmate cloned the repository and tried to build the code they ran into compiler error CS0116. We're both extremely confused since the file that the error is referencing is a file that is auto-generated by visual studio. On top of that, the error is related to having either a variable or a method outside of a class and directly in a namespace, but this code doesn't have any namespace to be seen. Below is the code that is causing the error. In fact, each line (apart from the comment) is causing the same error. Any help would be appreciated!

// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

We have tried deleting the entire class library folder that the auto-generated file was in then remake the library with a new name and reusing the original .cs code for the library. We expected this to work but it gave us the exact same error. Yet again, this worked for me on my Windows machine but the error was still occurring on the macOS machine.

c#

visual-studio

macos-big-sur

windows-11

0 Answers

Your Answer

Accepted video resources