private void InitializeFromModel(CSharpCompilerInputs compilerInputs, MSB.Execution.ProjectInstance executedProject) { compilerInputs.BeginInitialization(); compilerInputs.SetAllowUnsafeBlocks(this.ReadPropertyBool(executedProject, "AllowUnsafeBlocks")); compilerInputs.SetApplicationConfiguration(this.ReadPropertyString(executedProject, "AppConfigForCompiler")); compilerInputs.SetBaseAddress(this.ReadPropertyString(executedProject, "BaseAddress")); compilerInputs.SetCheckForOverflowUnderflow(this.ReadPropertyBool(executedProject, "CheckForOverflowUnderflow")); compilerInputs.SetCodePage(this.ReadPropertyInt(executedProject, "CodePage")); compilerInputs.SetDebugType(this.ReadPropertyString(executedProject, "DebugType")); compilerInputs.SetDefineConstants(this.ReadPropertyString(executedProject, "DefineConstants")); compilerInputs.SetFeatures(this.ReadPropertyString(executedProject, "Features")); var delaySignProperty = this.GetProperty("DelaySign"); compilerInputs.SetDelaySign(delaySignProperty != null && !string.IsNullOrEmpty(delaySignProperty.EvaluatedValue), this.ReadPropertyBool(executedProject, "DelaySign")); compilerInputs.SetDisabledWarnings(this.ReadPropertyString(executedProject, "NoWarn")); compilerInputs.SetDocumentationFile(this.GetItemString(executedProject, "DocFileItem")); compilerInputs.SetEmitDebugInformation(this.ReadPropertyBool(executedProject, "DebugSymbols")); compilerInputs.SetErrorReport(this.ReadPropertyString(executedProject, "ErrorReport")); compilerInputs.SetFileAlignment(this.ReadPropertyInt(executedProject, "FileAlignment")); compilerInputs.SetGenerateFullPaths(this.ReadPropertyBool(executedProject, "GenerateFullPaths")); compilerInputs.SetHighEntropyVA(this.ReadPropertyBool(executedProject, "HighEntropyVA")); bool signAssembly = this.ReadPropertyBool(executedProject, "SignAssembly"); if (signAssembly) { compilerInputs.SetKeyContainer(this.ReadPropertyString(executedProject, "KeyContainerName")); compilerInputs.SetKeyFile(this.ReadPropertyString(executedProject, "KeyOriginatorFile", "AssemblyOriginatorKeyFile")); } compilerInputs.SetLangVersion(this.ReadPropertyString(executedProject, "LangVersion")); compilerInputs.SetMainEntryPoint(null, this.ReadPropertyString(executedProject, "StartupObject")); compilerInputs.SetModuleAssemblyName(this.ReadPropertyString(executedProject, "ModuleAssemblyName")); compilerInputs.SetNoStandardLib(this.ReadPropertyBool(executedProject, "NoCompilerStandardLib")); compilerInputs.SetOptimize(this.ReadPropertyBool(executedProject, "Optimize")); compilerInputs.SetOutputAssembly(this.GetItemString(executedProject, "IntermediateAssembly")); compilerInputs.SetPdbFile(this.ReadPropertyString(executedProject, "PdbFile")); if (this.ReadPropertyBool(executedProject, "Prefer32Bit")) { compilerInputs.SetPlatformWith32BitPreference(this.ReadPropertyString(executedProject, "PlatformTarget")); } else { compilerInputs.SetPlatform(this.ReadPropertyString(executedProject, "PlatformTarget")); } compilerInputs.SetSubsystemVersion(this.ReadPropertyString(executedProject, "SubsystemVersion")); compilerInputs.SetTargetType(this.ReadPropertyString(executedProject, "OutputType")); // Decode the warning options from RuleSet file prior to reading explicit settings in the project file, so that project file settings prevail for duplicates. compilerInputs.SetRuleSet(this.ReadPropertyString(executedProject, "RuleSet")); compilerInputs.SetTreatWarningsAsErrors(this.ReadPropertyBool(executedProject, "TreatWarningsAsErrors")); compilerInputs.SetWarningLevel(this.ReadPropertyInt(executedProject, "WarningLevel")); compilerInputs.SetWarningsAsErrors(this.ReadPropertyString(executedProject, "WarningsAsErrors")); compilerInputs.SetWarningsNotAsErrors(this.ReadPropertyString(executedProject, "WarningsNotAsErrors")); compilerInputs.SetReferences(this.GetMetadataReferencesFromModel(executedProject).ToArray()); compilerInputs.SetAnalyzers(this.GetAnalyzerReferencesFromModel(executedProject).ToArray()); compilerInputs.SetAdditionalFiles(this.GetAdditionalFilesFromModel(executedProject).ToArray()); compilerInputs.SetSources(this.GetDocumentsFromModel(executedProject).ToArray()); string errorMessage; int errorCode; compilerInputs.EndInitialization(out errorMessage, out errorCode); }
private void InitializeFromModel(CSharpCompilerInputs compilerInputs, MSB.Execution.ProjectInstance executedProject) { compilerInputs.BeginInitialization(); compilerInputs.SetAllowUnsafeBlocks(this.ReadPropertyBool(executedProject, "AllowUnsafeBlocks")); compilerInputs.SetApplicationConfiguration(this.ReadPropertyString(executedProject, "AppConfigForCompiler")); compilerInputs.SetBaseAddress(this.ReadPropertyString(executedProject, "BaseAddress")); compilerInputs.SetCheckForOverflowUnderflow(this.ReadPropertyBool(executedProject, "CheckForOverflowUnderflow")); compilerInputs.SetCodePage(this.ReadPropertyInt(executedProject, "CodePage")); compilerInputs.SetDebugType(this.ReadPropertyString(executedProject, "DebugType")); compilerInputs.SetDefineConstants(this.ReadPropertyString(executedProject, "DefineConstants")); var delaySignProperty = this.GetProperty("DelaySign"); compilerInputs.SetDelaySign(delaySignProperty != null && !string.IsNullOrEmpty(delaySignProperty.EvaluatedValue), this.ReadPropertyBool(executedProject, "DelaySign")); compilerInputs.SetDisabledWarnings(this.ReadPropertyString(executedProject, "NoWarn")); compilerInputs.SetDocumentationFile(this.GetItemString(executedProject, "DocFileItem")); compilerInputs.SetEmitDebugInformation(this.ReadPropertyBool(executedProject, "DebugSymbols")); compilerInputs.SetErrorReport(this.ReadPropertyString(executedProject, "ErrorReport")); compilerInputs.SetFileAlignment(this.ReadPropertyInt(executedProject, "FileAlignment")); compilerInputs.SetGenerateFullPaths(this.ReadPropertyBool(executedProject, "GenerateFullPaths")); compilerInputs.SetHighEntropyVA(this.ReadPropertyBool(executedProject, "HighEntropyVA")); bool signAssembly = this.ReadPropertyBool(executedProject, "SignAssembly"); if (signAssembly) { compilerInputs.SetKeyContainer(this.ReadPropertyString(executedProject, "KeyContainerName")); compilerInputs.SetKeyFile(this.ReadPropertyString(executedProject, "KeyOriginatorFile", "AssemblyOriginatorKeyFile")); } compilerInputs.SetLangVersion(this.ReadPropertyString(executedProject, "LangVersion")); compilerInputs.SetMainEntryPoint(null, this.ReadPropertyString(executedProject, "StartupObject")); compilerInputs.SetModuleAssemblyName(this.ReadPropertyString(executedProject, "ModuleAssemblyName")); compilerInputs.SetNoStandardLib(this.ReadPropertyBool(executedProject, "NoCompilerStandardLib")); compilerInputs.SetOptimize(this.ReadPropertyBool(executedProject, "Optimize")); compilerInputs.SetOutputAssembly(this.GetItemString(executedProject, "IntermediateAssembly")); compilerInputs.SetPdbFile(this.ReadPropertyString(executedProject, "PdbFile")); if (this.ReadPropertyBool(executedProject, "Prefer32Bit")) { compilerInputs.SetPlatformWith32BitPreference(this.ReadPropertyString(executedProject, "PlatformTarget")); } else { compilerInputs.SetPlatform(this.ReadPropertyString(executedProject, "PlatformTarget")); } compilerInputs.SetSubsystemVersion(this.ReadPropertyString(executedProject, "SubsystemVersion")); compilerInputs.SetTargetType(this.ReadPropertyString(executedProject, "OutputType")); // Decode the warning options from RuleSet file prior to reading explicit settings in the project file, so that project file settings prevail for duplicates. compilerInputs.SetRuleSet(this.ReadPropertyString(executedProject, "RuleSet")); compilerInputs.SetTreatWarningsAsErrors(this.ReadPropertyBool(executedProject, "TreatWarningsAsErrors")); compilerInputs.SetWarningLevel(this.ReadPropertyInt(executedProject, "WarningLevel")); compilerInputs.SetWarningsAsErrors(this.ReadPropertyString(executedProject, "WarningsAsErrors")); compilerInputs.SetWarningsNotAsErrors(this.ReadPropertyString(executedProject, "WarningsNotAsErrors")); compilerInputs.SetReferences(this.GetMetadataReferencesFromModel(executedProject).ToArray()); compilerInputs.SetAnalyzers(this.GetAnalyzerReferencesFromModel(executedProject).ToArray()); compilerInputs.SetSources(this.GetDocumentsFromModel(executedProject).ToArray()); string errorMessage; int errorCode; compilerInputs.EndInitialization(out errorMessage, out errorCode); }