CSC:错误 CS0041:写入调试信息时出现意外错误——“此平台不支持操作." [英] CSC: error CS0041: Unexpected error writing debug information -- 'Operation is not supported on this platform.'

查看:23
本文介绍了CSC:错误 CS0041:写入调试信息时出现意外错误——“此平台不支持操作."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚下载了 Visual Studio Professional for Mac,我似乎无法构建任何东西,因为我总是遇到同样的错误:

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/Versions/4.8.0/lib/mono/xbuild/14.0/bin/Microsoft.CSharp.targets (CoreCompile target) ->

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

 19 Warning(s)
 1 Error(s)

不确定要对我的项目进行哪些更改才能编译.

Not sure what to change on my project to get things to compile.

推荐答案

我可以通过两种方式解决这个问题:

I was able to work around this problem two ways:

  1. HACK 通过从构建中删除调试符号(在 VS 窗口中:项目属性 -> 构建选项卡 -> 高级按钮 -> 将调试信息"下拉列表更改为无"-不确定 VS for Mac/Xamarin Studio 中的等价物)我为受影响项目的所有配置执行了此操作.拉回 macOS 环境,现在构建成功.当然没有调试信息,但它可以在不破坏任何部门的情况下工作.

  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.

NON-HACK 根本原因是对 ASP.NET Web 项目使用 Roslyn 编译器/工具,并且此工具生成 PDB 文件而不是 MDB 文件,并且构建失败尝试在 macOS 平台上生成 PDB 文件(呃平台不受支持".)了解根本原因,我们还可以从受影响的项目中删除以下 nuget 包:

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:

<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net45" developmentDependency="true" />

目前还不清楚删除这两个软件包会牺牲什么.这确实允许我构建包含调试信息的受影响项目.受影响的项目仅包含 webapi 端点,没有使用 MVC 或 Razor 引擎.如果他们在此更改的上游遇到问题,很高兴听到其他人的经验.

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

这篇关于CSC:错误 CS0041:写入调试信息时出现意外错误——“此平台不支持操作."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆