protected override string GenerateCommandLineCommands() { var cmd = new CommandLineArgumentBuilder(); #if DEBUG cmd.Add("/v"); #endif cmd.Add("/nostdlib"); cmd.AddQuotedSwitchIfNotNull("/baselib:", BaseLibDll); cmd.AddQuotedSwitchIfNotNull("/out:", OutputAssembly); cmd.AddQuotedSwitchIfNotNull("/attributelib:", AttributeAssembly); string dir; if (!string.IsNullOrEmpty(BaseLibDll)) { dir = Path.GetDirectoryName(BaseLibDll); cmd.AddQuotedSwitchIfNotNull("/lib:", dir); } if (ProcessEnums) { cmd.Add("/process-enums"); } if (EmitDebugInformation) { cmd.Add("/debug"); } if (AllowUnsafeBlocks) { cmd.Add("/unsafe"); } if (!string.IsNullOrEmpty(DotNetCscCompiler)) { var compileCommand = new string [] { DotNetPath, DotNetCscCompiler, }; cmd.AddQuoted("/compile-command:" + string.Join(" ", StringUtils.QuoteForProcess(compileCommand))); } cmd.AddQuotedSwitchIfNotNull("/ns:", Namespace); if (NoNFloatUsing) { cmd.Add("/no-nfloat-using:true"); } if (!string.IsNullOrEmpty(DefineConstants)) { var strv = DefineConstants.Split(new [] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (var str in strv) { cmd.AddQuoted("/d:" + str); } } //cmd.AppendSwitch ("/e"); foreach (var item in ApiDefinitions) { cmd.AddQuoted(Path.GetFullPath(item.ItemSpec)); } if (CoreSources != null) { foreach (var item in CoreSources) { cmd.AddQuoted("/s:" + Path.GetFullPath(item.ItemSpec)); } } if (Sources != null) { foreach (var item in Sources) { cmd.AddQuoted("/x:" + Path.GetFullPath(item.ItemSpec)); } } if (AdditionalLibPaths != null) { foreach (var item in AdditionalLibPaths) { cmd.AddQuoted("/lib:" + Path.GetFullPath(item.ItemSpec)); } } HandleReferences(cmd); if (Resources != null) { foreach (var item in Resources) { var argument = item.ToString(); var id = item.GetMetadata("LogicalName"); if (!string.IsNullOrEmpty(id)) { argument += "," + id; } cmd.AddQuoted("/res:" + argument); } } if (NativeLibraries != null) { foreach (var item in NativeLibraries) { var argument = item.ToString(); var id = item.GetMetadata("LogicalName"); if (string.IsNullOrEmpty(id)) { id = Path.GetFileName(argument); } cmd.AddQuoted("/res:" + argument + "," + id); } } if (GeneratedSourcesDir != null) { cmd.AddQuoted("/tmpdir:" + Path.GetFullPath(GeneratedSourcesDir)); } if (GeneratedSourcesFileList != null) { cmd.AddQuoted("/sourceonly:" + Path.GetFullPath(GeneratedSourcesFileList)); } cmd.Add($"/target-framework={TargetFrameworkMoniker}"); if (!string.IsNullOrEmpty(ExtraArgs)) { var extraArgs = CommandLineArgumentBuilder.Parse(ExtraArgs); var target = OutputAssembly; string projectDir; if (ProjectDir.StartsWith("~/", StringComparison.Ordinal)) { // Note: Since the Visual Studio plugin doesn't know the user's home directory on the Mac build host, // it simply uses paths relative to "~/". Expand these paths to their full path equivalents. var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); projectDir = Path.Combine(home, ProjectDir.Substring(2)); } else { projectDir = ProjectDir; } var customTags = new Dictionary <string, string> (StringComparer.OrdinalIgnoreCase) { { "projectdir", projectDir }, // Apparently msbuild doesn't propagate the solution path, so we can't get it. // { "solutiondir", proj.ParentSolution != null ? proj.ParentSolution.BaseDirectory : proj.BaseDirectory }, }; // OutputAssembly is optional so it can be null if (target != null) { var d = Path.GetDirectoryName(target); var n = Path.GetFileName(target); customTags.Add("targetpath", Path.Combine(d, n)); customTags.Add("targetdir", d); customTags.Add("targetname", n); customTags.Add("targetext", Path.GetExtension(target)); } for (int i = 0; i < extraArgs.Length; i++) { var argument = extraArgs[i]; cmd.Add(StringParserService.Parse(argument, customTags)); } } cmd.Add(VerbosityUtils.Merge(ExtraArgs, (LoggerVerbosity)Verbosity)); var commandLine = cmd.CreateResponseFile(this, ResponseFilePath, null); if (IsDotNet) { commandLine = StringUtils.Quote(Path.Combine(BTouchToolPath, BTouchToolExe)) + " " + commandLine; } return(commandLine.ToString()); }