Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C#

Thomas L
Thomas L
7,703 Points

Do you have a hard time following any C# courses (Learn C# and ASP.NET Web Development) on Visual Studio for Mac?

I enrolled in the tracks mentioned in the title of this thread, however, I am not able to complete them for the following reasons:

-Unit Testing part from Learn C# does not work on a Mac (More info: https://teamtreehouse.com/community/unit-testing-for-vs2017-on-mac-not-working )

-ASP.NET MVC Form, the boilerplate project does not compile. (Error CS1902: Invalid option 'portable' for /debug; must be full or pdbonly (CS1902) (Treehouse.FitnessFrog)). I have tried to switch the Debug Information to: Full/Portable and even None but it does not solve the problem.

As advised on Stack Overflow I also removed those lines: <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net461" />

<package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net461" developmentDependency="true" />

Did not solve the problem either.

I am kinda running out of solution, except installing a Windows on my Mac.

Is there any way to fix those problems in order to complete those tracks?

Thanks in advance.

Steven Parker
Steven Parker
229,981 Points

You can also contact the Support staff directly for problems with the courses.

1 Answer

James Churchill
STAFF
James Churchill
Treehouse Teacher

Thomas,

Sorry to hear about the troubles you're running into. As you're discovering, VS for Mac is not the same things as VS on Windows. VS for Mac is a recent rebranding of Xamarin Studio, though they're two different products. That being said, it's definitely possible to use VS for Mac to develop .NET and ASP.NET applications.

When doing that, you'll either target Mono (open source version of the full .NET Framework) or .NET Core (new cross-platform version of .NET that's officially supported by MS). Almost all of our C# and ASP.NET courses and workshops here at Treehouse focus on the full .NET Framework, not .NET Core (or ASP.NET Core). In the next year, you'll start to see more .NET Core and ASP.NET Core content from Treehouse.

It's definitely possible to use xUnit with VS for Mac (I've recently done this myself). There's a VS extension that you need to download and install. Instructions on how to do that can be found here: https://github.com/xunit/xamarinstudio.xunit

Regarding the boilerplate project files for the ASP.NET MVC Forms course, you're running into the differences between a project that was built to target the full .NET Framework and a project that's build to target Mono (which is what you need when using VS for Mac). To workaround this issue, I'd create a new ASP.NET MVC project using VS for Mac, and copy over the code from the course project files. When creating the new project, be sure to create an ASP.NET MVC project, not an ASP.NET Core project.

Going forward, you might find it easier to run VS on Windows. If not, you'll keep running into differences between the two versions of the tooling.

I hope this helps.

Thanks ~James