我正在调试使用Roslyn csc.exe编译器编译的修改过的C#pure .NET CoreCLR Hello World应用程序。 Hello World C#程序如下所示:
using System;
namespace TestingMonoDevelop6.0
{
class MainClass
{
public static void Main(string[] args)
{
string value = "one";
Console.WriteLine("Hello World!");
}
}
}
这是Roslyn csc.exe编译器指令和结果:
构建TestingMonoDevelop6.0(Debug | x86)执行: /home/venkat/roslyn/Binaries/Debug/csc.exe / noconfig / nostdlib / debug:portable /out:/home/venkat/Caisse/Caisse/bin/Debug/Caisse.exe /r:/home/venkat/Sandbox/Microsoft.CodeAnalysis.dll /r:/home/venkat/Sandbox/Microsoft.Data.Sq
Microsoft(R)Visual C#编译器版本42.42.42.42 版权所有(C)Microsoft Corporation。保留所有权利。
Program.cs(9,11):警告CS0219:变量'值'已分配,但其值从未使用
----------------------完成----------------------
建立成功。
这是Ubuntu Linux 14.04 LTS单声道版本和路径。
[mono-2015.12.15 + 14.05.01] venkat @ clickit:〜/ monodevelop $ which mono /opt/mono-2015.12.15+14.05.01/bin/mono
所以,有人告诉我,Monodevelop 6.0将在github.io.mono.monodevelop论坛上支持Roslyn csc.exe编译。我的第一个问题是我们如何要求使用Roslyn csc.exe编译器编译Monodevelop 6.0?
当我创建以下Monodevelop 6.0 C#自定义构建步骤时 Ubuntu:
/home/venkat/roslyn/Binaries/Debug/csc.exe /noconfig /nostdlib /debug:portable /out:/home/venkat/December14/December14/bin/Debug/Program.exe /r:/home/venkat/Sandbox/Microsoft.CodeAnalysis.dll /r:/home/venkat/Sandbox/Microsoft.Data.Sqlite.dll /r:/home/venkat/.dnx/packages/System.Collections/4.0.11-beta-23409/ref/dotnet/System.Collections.dll /r:/home/venkat/.dnx/packages/System.Collections.NonGeneric/4.0.0/ref/dotnet/System.Collections.NonGeneric.dll /r:/home/venkat/.dnx/packages/System.ComponentModel/4.0.1-beta-23516/ref/dotnet5.1/System.ComponentModel.dll /r:/home/venkat/Sandbox/System.dll /r:/home/venkat/.dnx/packages/System.Data.Common/4.0.1-beta-23516/ref/dotnet5.1/System.Data.Common.dll /r:/home/venkat/.dnx/packages/System.Xml.ReaderWriter/4.0.10-beta-22816/lib/contract/System.Xml.ReaderWriter.dll /r:/home/venkat/.dnx/packages/System.Xml.XmlDocument/4.0.0-beta-22816/lib/contract/System.Xml.XmlDocument.dll /r:/home/venkat/.dnx/packages/Microsoft.CSharp/4.0.1-beta-23409/ref/dotnet/Microsoft.CSharp.dll /r:/home/venkat/Sandbox/System.Runtime.dll /r:/home/venkat/Sandbox/System.Xml.XDocument.dll /r:/home/venkat/Sandbox/System.Xml.dll /r:/home/venkat/Sandbox/System.Threading.Tasks.dll /r:/home/venkat/Sandbox/System.Linq.dll /r:/home/venkat/Sandbox/System.Xml.dll /r:/home/venkat/Sandbox/mscorlib.dll Program.cs
,
它成功编译。当我开始调试Roslyn生成的可执行文件并在i上使用Monodevelop Watch窗口时,我收到以下错误
消息:未知变量i
当我在Console.WriteLine(" Hello World!")行上设置断点时。
我的第三个问题是我是否必须创建自定义执行步骤 用于Linux的Monodevelop 6.0引用Corerun Program.exe而不是 mono Program.exe?
答案 0 :(得分:0)
问题1的答案,“我们如何要求使用Roslyn csc.exe编译器编译Monodevelop 6.0?”是:
/home/venkat/roslyn/Binaries/Debug/csc.exe /noconfig
/nostdlib /debug:portable
/out:/home/venkat/December14/December14/bin/Debug/Program.exe
/r:/home/venkat/Sandbox/Microsoft.CodeAnalysis.dll
/r:/home/venkat/Sandbox/Microsoft.Data.Sqlite.dll
/r:/home/venkat/.dnx/packages/System.Collections/4.0.11-beta-23409/ref/dotnet/System.Collections.dll
/r:/home/venkat/.dnx/packages/System.Collections.NonGeneric/4.0.0/ref/dotnet/System.Collections.NonGeneric.dll
/r:/home/venkat/.dnx/packages/System.ComponentModel/4.0.1-beta-23516/ref/dotnet5.1/System.ComponentModel.dll
/r:/home/venkat/Sandbox/System.dll
/r:/home/venkat/.dnx/packages/System.Data.Common/4.0.1-beta-23516/ref/dotnet5.1/System.Data.Common.dll
/r:/home/venkat/.dnx/packages/System.Xml.ReaderWriter/4.0.10-beta-22816/lib/contract/System.Xml.ReaderWriter.dll
/r:/home/venkat/.dnx/packages/System.Xml.XmlDocument/4.0.0-beta-22816/lib/contract/System.Xml.XmlDocument.dll
/r:/home/venkat/.dnx/packages/Microsoft.CSharp/4.0.1-beta-23409/ref/dotnet/Microsoft.CSharp.dll
/r:/home/venkat/Sandbox/System.Runtime.dll
/r:/home/venkat/Sandbox/System.Xml.XDocument.dll
/r:/home/venkat/Sandbox/System.Xml.dll
/r:/home/venkat/Sandbox/System.Threading.Tasks.dll
/r:/home/venkat/Sandbox/System.Linq.dll
/r:/home/venkat/Sandbox/System.Xml.dll
/r:/home/venkat/Sandbox/mscorlib.dll Program.cs
,
问题2的答案,“当我开始调试Roslyn生成的可执行文件并在i上使用Monodevelop Watch窗口时,我收到以下错误 消息:未知变量i 当我在Console.WriteLine(“Hello World!”)行设置一个断点时。“。是单声道运行时mdb没有错误,非Window OS上的Roslyn编译器只能生成便携式pdb。有一个可重现的Macintosh在XamarinStudio->调试器组件下的https://bugzilla.xamarin.com/处打开错误。请参阅https://gitter.im/dotnet/roslyn。
问题3的答案,我是否必须在Monodevelop 6.0 for Linux中创建自定义执行步骤,引用Corerun Program.exe而不是单声道Program.exe?是。事实上,如果希望定位CoreCLR,他们应该使用Roslyn csc.exe编译器。