123
124
foreach (ProjectReference lib in projectItems.GetAll <ProjectReference> ()) {
124
125
if (lib.ReferenceType == ReferenceType.Project && !(lib.OwnerProject.ParentSolution.FindProjectByName (lib.Reference) is DotNetProject))
127
string refPrefix = string.IsNullOrEmpty (lib.Aliases) ? "" : lib.Aliases + "=";
126
128
foreach (string fileName in lib.GetReferencedFileNames (configSelector)) {
127
129
switch (lib.ReferenceType) {
128
130
case ReferenceType.Package:
136
138
if (alreadyAddedReference.Add (fileName))
137
AppendQuoted (sb, "/r:", fileName);
139
AppendQuoted (sb, "/r:", refPrefix + fileName);
139
141
if (pkg.GacRoot != null && !gacRoots.Contains (pkg.GacRoot))
140
142
gacRoots.Add (pkg.GacRoot);
154
156
if (alreadyAddedReference.Add (fileName))
155
AppendQuoted (sb, "/r:", fileName);
157
AppendQuoted (sb, "/r:", refPrefix + fileName);
172
174
if (configuration.SignAssembly) {
173
175
if (File.Exists (configuration.AssemblyKeyFile))
174
176
AppendQuoted (sb, "/keyfile:", configuration.AssemblyKeyFile);
177
if (configuration.DebugMode) {
178
// sb.AppendLine ("/debug:+");
179
sb.AppendLine ("/debug:full");
182
switch (compilerParameters.LangVersion) {
183
case LangVersion.Default:
185
case LangVersion.ISO_1:
186
sb.AppendLine ("/langversion:ISO-1");
188
case LangVersion.ISO_2:
189
sb.AppendLine ("/langversion:ISO-2");
192
string message = "Invalid LangVersion enum value '" + compilerParameters.LangVersion.ToString () + "'";
193
monitor.ReportError (message, null);
194
LoggingService.LogError (message);
177
if (configuration.DelaySign)
178
sb.AppendLine ("/delaySign");
181
var debugType = compilerParameters.DebugType;
182
if (string.IsNullOrEmpty (debugType)) {
183
debugType = configuration.DebugMode ? "full" : "none";
184
} else if (string.Equals (debugType, "pdbonly", StringComparison.OrdinalIgnoreCase)) {
185
//old Mono compilers don't support pdbonly
186
if (monoRuntime != null && !monoRuntime.HasMultitargetingMcs)
189
if (!string.Equals (debugType, "none", StringComparison.OrdinalIgnoreCase)) {
190
sb.AppendLine ("/debug:" + debugType);
193
if (compilerParameters.LangVersion != LangVersion.Default) {
194
var langVersionString = CSharpCompilerParameters.TryLangVersionToString (compilerParameters.LangVersion);
195
if (langVersionString == null) {
196
string message = "Invalid LangVersion enum value '" + compilerParameters.LangVersion.ToString () + "'";
197
monitor.ReportError (message, null);
198
LoggingService.LogError (message);
201
sb.AppendLine ("/langversion:" + langVersionString);
198
204
// mcs default is + but others might not be
329
335
ExecutionEnvironment envVars = runtime.GetToolsExecutionEnvironment (project.TargetFramework);
330
336
string cargs = "/noconfig @\"" + responseFileName + "\"";
332
int exitCode = DoCompilation (compilerName, cargs, workingDir, envVars, gacRoots, ref output, ref error);
338
int exitCode = DoCompilation (monitor, compilerName, cargs, workingDir, envVars, gacRoots, ref output, ref error);
334
340
BuildResult result = ParseOutput (output, error);
335
341
if (result.CompilerOutput.Trim ().Length != 0)
414
static int DoCompilation (string compilerName, string compilerArgs, string working_dir, ExecutionEnvironment envVars, List<string> gacRoots, ref string output, ref string error)
420
static int DoCompilation (IProgressMonitor monitor, string compilerName, string compilerArgs, string working_dir, ExecutionEnvironment envVars, List<string> gacRoots, ref string output, ref string error)
416
output = Path.GetTempFileName();
417
error = Path.GetTempFileName();
422
output = Path.GetTempFileName ();
423
error = Path.GetTempFileName ();
419
425
StreamWriter outwr = new StreamWriter (output);
420
426
StreamWriter errwr = new StreamWriter (error);
438
444
pinfo.UseShellExecute = false;
439
445
pinfo.RedirectStandardOutput = true;
440
446
pinfo.RedirectStandardError = true;
442
448
MonoDevelop.Core.Execution.ProcessWrapper pw = Runtime.ProcessService.StartProcess (pinfo, outwr, errwr, null);
449
using (var mon = new AggregatedOperationMonitor (monitor, pw)) {
444
452
int exitCode = pw.ExitCode;
451
459
// Snatched from our codedom code, with some changes to make it compatible with csc
452
460
// (the line+column group is optional is csc)
453
static Regex regexError = new Regex (@"^(\s*(?<file>[^\(]+)(\((?<line>\d*)(,(?<column>\d*[\+]*))?\))?:\s+)*(?<level>\w+)\s+(?<number>..\d+):\s*(?<message>.*)", RegexOptions.Compiled | RegexOptions.ExplicitCapture);
461
static Regex regexError = new Regex (@"^(\s*(?<file>.+[^)])(\((?<line>\d*)(,(?<column>\d*[\+]*))?\))?:\s+)*(?<level>\w+)\s+(?<number>..\d+):\s*(?<message>.*)", RegexOptions.Compiled | RegexOptions.ExplicitCapture);
454
462
static BuildError CreateErrorFromString (string error_string)
456
464
// When IncludeDebugInformation is true, prevents the debug symbols stats from braeking this.