CSC: error CS0041: Unexpected error writing debug information — 'Operation is not supported on this platform.'

前端 未结 5 807
生来不讨喜
生来不讨喜 2021-02-04 05:52

Just downloaded Visual Studio Professional for Mac and I cannot seem to build anything as I always get the same error:

/Library/Frameworks/Mono.framework/Version         


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-04 06:54

    I was able to work around this problem two ways:

    1. HACK By removing debug symbols from the build (in VS windows: Project Properties -> Build Tab -> Advanced button -> change "Debug Info" dropdown to "none" -- not sure what equivalent is in VS for Mac / Xamarin Studio) I did this for all configurations of affected project(s). Pulled back to macOS env, build now succeeds. No debug info of course, but it works without breaking any deps.

    2. NON-HACK Root cause is the use of Roslyn compiler/tools for ASP.NET Web projects, and this tool produces PDB files instead of MDB files, and the build fails trying to produce PDB files on macOS platform (er go "platform unsupported".) Knowing the root cause we can also remove the following nuget packages from the affected projects:

      
      
      

    It's unclear what is sacrificed by removing these two packages. This does allow me to build the affected projects with the debug info included. The affected projects only contained webapi endpoints, and no use of MVC nor Razor engine. It would be nice to hear the experiences of others if they had issues upstream from this change.

    HTH

提交回复
热议问题