public static ProjectProperties InitializeProperties(Settings settings, Log log) { // General Properites var properties = new ProjectProperties(); var currentDirectory = Directory.GetCurrentDirectory(); var buildDll = settings.Target == "library"; properties.ProjectDirectory = Path.Combine(currentDirectory); properties.PackagesDirectory = Path.Combine(properties.ProjectDirectory, "packages"); properties.OutputDirectory = Path.Combine(properties.ProjectDirectory, "bin"); properties.ToolsDirectory = Path.Combine(properties.ProjectDirectory, "tools"); properties.AssemblyName = Path.GetFileName(properties.ProjectDirectory); properties.OutputType = buildDll ? ".dll" : ".exe"; FindCompiler(properties); AddToListWithoutDuplicates(properties.Sources, ParseProjectFile(properties, settings.ProjectFile, "Compile")); foreach (var file in settings.SourceFiles.Where(f => !f.StartsWith(properties.PackagesDirectory) && !f.StartsWith(properties.OutputDirectory) && !f.StartsWith(properties.ToolsDirectory))) { AddToListWithoutDuplicates(properties.Sources, file); } if (!string.IsNullOrWhiteSpace(settings.Recurse) && settings.Recurse != "*.cs") { AddToListWithoutDuplicates(properties.Sources, Directory.GetFiles(properties.ProjectDirectory, settings.Recurse, SearchOption.AllDirectories)); } if (properties.Sources.Count == 1) { properties.AssemblyName = Path.GetFileNameWithoutExtension(properties.Sources[0]); } var platformOptionSpecicifcation = GetPlatformOption(settings.Platform); // The anycpu32bitpreferred setting is valid only for executable (.EXE) files if (!(settings.Platform == "anycpu32bitpreferred" && buildDll)) properties.CscOptions.Add("/platform:" + settings.Platform); // Packages properties.Packages.Add(@"""Microsoft.NETCore"": ""5.0.0"""); properties.Packages.Add(@"""System.Console"": ""4.0.0-beta-23123"""); //properties.Packages.Add(@"""Microsoft.NETCore.Console"": ""1.0.0-beta-*"""); properties.Packages.Add(GetConsoleHost(platformOptionSpecicifcation)); properties.Packages.Add(GetRuntimeCoreClr(platformOptionSpecicifcation)); // References properties.References.Add(Path.Combine(properties.PackagesDirectory, @"System.Runtime\4.0.20\ref\dotnet\System.Runtime.dll")); properties.References.Add(Path.Combine(properties.PackagesDirectory, @"System.Console\4.0.0-beta-23123\ref\dotnet\System.Console.dll")); // Runtime Dependencies properties.Dependencies.Add(Path.Combine(properties.PackagesDirectory, GetRuntimeCoreClrDependencyNative(platformOptionSpecicifcation, "win7"))); properties.Dependencies.Add(Path.Combine(properties.PackagesDirectory, GetRuntimeCoreClrDependencyLibrary(platformOptionSpecicifcation, "win7"))); properties.Dependencies.Add(Path.Combine(properties.PackagesDirectory, @"System.Runtime\4.0.20\lib\netcore50")); properties.Dependencies.Add(Path.Combine(properties.PackagesDirectory, @"System.Console\4.0.0-beta-23123\lib\DNXCore50")); properties.Dependencies.Add(Path.Combine(properties.PackagesDirectory, @"System.IO\4.0.10\lib\netcore50")); properties.Dependencies.Add(Path.Combine(properties.PackagesDirectory, @"System.Threading\4.0.10\lib\netcore50")); properties.Dependencies.Add(Path.Combine(properties.PackagesDirectory, @"System.IO.FileSystem.Primitives\4.0.0\lib\dotnet")); properties.Dependencies.Add(Path.Combine(properties.PackagesDirectory, @"System.Text.Encoding\4.0.10\lib\netcore50")); properties.Dependencies.Add(Path.Combine(properties.PackagesDirectory, @"System.Threading.Tasks\4.0.10\lib\netcore50")); properties.Dependencies.Add(Path.Combine(properties.PackagesDirectory, @"System.Text.Encoding.Extensions\4.0.10\lib\netcore50")); properties.Dependencies.Add(Path.Combine(properties.PackagesDirectory, @"System.Runtime.InteropServices\4.0.20\lib\netcore50")); // CSC OPTIONS properties.CscOptions.Add("/nostdlib"); properties.CscOptions.Add("/noconfig"); if (settings.Unsafe) { properties.CscOptions.Add("/unsafe"); } if (settings.Optimize) { properties.CscOptions.Add("/optimize"); } if (!string.IsNullOrWhiteSpace(settings.Debug)) { properties.CscOptions.Add("/debug:" + settings.Debug); } properties.CscOptions.Add("/target:" + settings.Target); LogProperties(log, properties, "Initialized Properties Log:", buildDll); Adjust(properties, Path.Combine(properties.ProjectDirectory, "dependencies.txt"), properties.Dependencies); Adjust(properties, Path.Combine(properties.ProjectDirectory, "references.txt"), properties.References); AddToListWithoutDuplicates(properties.Packages, ParseProjectFile(properties, settings.ProjectFile, "Package")); LogProperties(log, properties, "Adjusted Properties Log:", buildDll); return properties; }