Invalid Visual Studio for MAC debug build error
I am getting the following error while building a .NET Core MVC application.
Projects / MVCCoreTest / MVCCoreTest / CSC: Error CS1902: Invalid debug option portable'. Valid options are
full 'or `pdbonly' (CS1902) (MVCCoreTest)
What does this mean and where can I set these valid parameters?
I should clarify that if you build a project with VS for Mac you shouldn't have this problem, but if you clone it for example and build it on Windows then you probably get this problem.
I resolved the error by removing the Nuget packages associated with the Roslyn compiler:
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net452" />
<package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net452" developmentDependency="true" />
so the Mono compiler will run. It is for this reason that the csc compiler prevails over the mcs
Also don't forget to remove lines from csproj:
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
Hope it helps,
Sincerely.
-
Select project options by right clicking on the project ....
-
Go to "Compiler"
-
Change "Debug Info" to "Full" or "Portable". He must solve this problem.
Please let me know if this helped.
You can upgrade mono to 5.0, this is a bug in mono 4.8.0 with MSBuild.
You can also update the package link from Microsoft.Net.Compilers.1.0.0 to Microsoft.Net.Compilers.2.10.0 which worked for me.
The update NuGet packages
fixes the error for me. From the menu bar select:
Project > Update NuGet Packages
and it's over, you are all set