Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid Debug Option Build Error Visual Studio for MAC

I am getting following error while building .NET Core MVC App.

Projects/MVCCoreTest/MVCCoreTest/CSC: Error CS1902: Invalid debug option portable'. Valid options arefull' or `pdbonly' (CS1902) (MVCCoreTest)

What does this mean and where do i set those valid options ?

like image 436
aspxsushil Avatar asked Apr 01 '17 11:04

aspxsushil


1 Answers

I should clarify that if you create the project with VS for Mac you shouldn't have this issue, but if you clone it for example and was created in Windows then probably you will get this problem.

I resolved the error by removing the Nuget packages related with 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 take place. This is the reason why csc compiler prevale over the mcs

Also don't forget to remove the lines from the 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 this helps,

Regards.

like image 179
Cairo Avatar answered Sep 20 '22 18:09

Cairo