in vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectNode.cs [2338:2524]
internal virtual ProjectOptions GetProjectOptions(ConfigCanonicalName configCanonicalName)
{
if (this.options != null && this.options.ConfigCanonicalName == configCanonicalName)
return this.options;
ProjectOptions options = this.options = CreateProjectOptions(configCanonicalName);
options.GenerateExecutable = true;
this.SetConfiguration(configCanonicalName);
string outputPath = this.GetOutputPath();
if (!String.IsNullOrEmpty(outputPath))
{
// absolutize relative to project folder location
outputPath = Path.Combine(this.ProjectFolder, outputPath);
}
// Set some default values
options.OutputAssembly = outputPath + this.Caption + ".exe";
options.ModuleKind = ModuleKindFlags.ConsoleApplication;
options.RootNamespace = GetProjectProperty(ProjectFileConstants.RootNamespace, false);
options.OutputAssembly = outputPath + this.GetAssemblyName(configCanonicalName);
string outputtype = GetProjectProperty(ProjectFileConstants.OutputType, false);
if (!string.IsNullOrEmpty(outputtype))
{
outputtype = outputtype.ToLower(CultureInfo.InvariantCulture);
}
if (outputtype == "library")
{
options.ModuleKind = ModuleKindFlags.DynamicallyLinkedLibrary;
options.GenerateExecutable = false; // DLL's have no entry point.
}
else if (outputtype == "winexe")
options.ModuleKind = ModuleKindFlags.WindowsApplication;
else
options.ModuleKind = ModuleKindFlags.ConsoleApplication;
options.Win32Icon = GetProjectProperty("ApplicationIcon", false);
options.MainClass = GetProjectProperty("StartupObject", false);
string targetPlatform = GetProjectProperty("TargetPlatform", false);
if (targetPlatform != null && targetPlatform.Length > 0)
{
try
{
options.TargetPlatform = (PlatformType)Enum.Parse(typeof(PlatformType), targetPlatform);
}
catch (ArgumentException e)
{
Trace.WriteLine("Exception : " + e.Message);
}
options.TargetPlatformLocation = GetProjectProperty("TargetPlatformLocation", false);
this.SetTargetPlatform(options);
}
// other settings from CSharp we may want to adopt at some point...
// AssemblyKeyContainerName = "" //This is the key file used to sign the interop assembly generated when importing a com object via add reference
// AssemblyOriginatorKeyFile = ""
// DelaySign = "false"
// DefaultClientScript = "JScript"
// DefaultHTMLPageLayout = "Grid"
// DefaultTargetSchema = "IE50"
// PreBuildEvent = ""
// PostBuildEvent = ""
// RunPostBuildEvent = "OnBuildSuccess"
// transfer all config build options...
if (GetBoolAttr("AllowUnsafeBlocks"))
{
options.AllowUnsafeCode = true;
}
string baseAddressPropertyString = GetProjectProperty("BaseAddress", false);
try
{
var result = ParsePropertyValueToInt64(baseAddressPropertyString);
if (result.HasValue)
options.BaseAddress = result.Value;
}
catch (Exception e)
{
Trace.WriteLine(string.Format("Exception parsing property {0}='{1}': {2}", "BaseAddress", baseAddressPropertyString, e.Message));
}
if (GetBoolAttr("CheckForOverflowUnderflow"))
{
options.CheckedArithmetic = true;
}
if (GetProjectProperty("DefineConstants", false) != null)
{
options.DefinedPreProcessorSymbols = new StringCollection();
foreach (string s in GetProjectProperty("DefineConstants", false).Replace(" \t\r\n", "").Split(';'))
{
options.DefinedPreProcessorSymbols.Add(s);
}
}
string docFile = GetProjectProperty("DocumentationFile", false);
if (!String.IsNullOrEmpty(docFile))
{
options.XMLDocFileName = Path.Combine(this.ProjectFolder, docFile);
}
if (GetBoolAttr("DebugSymbols"))
{
options.IncludeDebugInformation = true;
}
if (GetProjectProperty("FileAlignment", false) != null)
{
try
{
options.FileAlignment = Int32.Parse(GetProjectProperty("FileAlignment", false), CultureInfo.InvariantCulture);
}
catch (ArgumentNullException e)
{
Trace.WriteLine("Exception : " + e.Message);
}
catch (ArgumentException e)
{
Trace.WriteLine("Exception : " + e.Message);
}
catch (FormatException e)
{
Trace.WriteLine("Exception : " + e.Message);
}
catch (OverflowException e)
{
Trace.WriteLine("Exception : " + e.Message);
}
}
if (GetBoolAttr("IncrementalBuild"))
{
options.IncrementalCompile = true;
}
if (GetBoolAttr("Optimize"))
{
options.Optimize = true;
}
if (GetBoolAttr("RegisterForComInterop"))
{
}
if (GetBoolAttr("RemoveIntegerChecks"))
{
}
if (GetBoolAttr("TreatWarningsAsErrors"))
{
options.TreatWarningsAsErrors = true;
}
if (GetProjectProperty("WarningLevel", false) != null)
{
try
{
options.WarningLevel = Int32.Parse(GetProjectProperty("WarningLevel", false), CultureInfo.InvariantCulture);
}
catch (ArgumentNullException e)
{
Trace.WriteLine("Exception : " + e.Message);
}
catch (ArgumentException e)
{
Trace.WriteLine("Exception : " + e.Message);
}
catch (FormatException e)
{
Trace.WriteLine("Exception : " + e.Message);
}
catch (OverflowException e)
{
Trace.WriteLine("Exception : " + e.Message);
}
}
return options;
}