Reputation: 91
I just recently swapped my MS PC for an Mac, I'm trying to continue working on an MVC project, but I'm getting an error (Error CS1902: Invalid option 'portable' for /debug; must be full or pdbonly (CS1902)).
Are there any good documents that explain how to make it work? I have seen people porting MVC to .NET Core, but I can't get the analyser to work on my Mac (not sure it's supported yet).
Upvotes: 5
Views: 4085
Reputation: 98
I did two things.
I update the Microsoft.Net.Compliers via nuget. https://www.nuget.org/packages/Microsoft.Net.Compilers/
Change one value in the properties of project. https://johnharold.wordpress.com/2017/08/16/csc-error-cs1902-invalid-option-portable-for-debug-must-be-full-or-pdbonly-cs1902/
I wish you can solve the problem
Upvotes: 5
Reputation: 201
I had this same problem when trying to use Visual Studio for Mac to build a solution that works fine in Windows. Turns out the /debug:portable
flag was being passed to the build command, even though the 'Debug Information' was correctly set to 'Full' in my project settings. Search the build output for 'portable' and you will indeed find the flag there regardless of your settings.
The fix is to upgrade the Microsoft.Net.Compilers nuget package. In my case, it upgraded from 1.0 to 2.7, and then the project built successfully.
Upvotes: 4
Reputation: 762
Right click on the project in the solution explorer and go to Options, Build, Compiler and change Debug information to Full
Upvotes: -4