public xTargetBuilder(CSBuildConfig config, BuildTarget target, string[] properties) { _config = config; _target = Check.NotNull(target); _build = BuildList.CreateInstance(_target.Toolset.ToString().Insert(2, ".").TrimStart('v'), _target.FrameworkPath, GetReferenceFolders().Length > 0); new TargetBuilderDispatch(this, _build); if (config.Console != null) _build.SetConsoleLevel(config.Console.Level); if (_target.TextLog != null) _build.SetTextLogFile(Environment.CurrentDirectory, _target.TextLog.AbsolutePath, _target.TextLog.Level); if (_target.XmlLog != null) _build.SetXmlLogFile(Environment.CurrentDirectory, _target.XmlLog.AbsolutePath, _target.XmlLog.Level); _build.SetProperty("Configuration", _target.Configuration); _build.SetProperty("Platform", _target.Platform.ToString()); foreach (string property in properties) { string[] values = property.Split( new char [] { '=', ':' }, 2); if (values.Length == 2) { Log.Verbose("Setting property {0} = {1}", values[0], values[1]); _build.SetProperty(values[0], values[1]); } } Log.Info("Using Configuration = {0}", _build.GetProperty("Configuration")); Log.Info("Using Platform = {0}", _build.GetProperty("Platform")); }
public static BuildList CreateInstance(string toolsVersion, string frameworkDir, bool hardReferences) { if (__domain != null) { //need to get rid of old domain... AppDomain.Unload(__domain); __domain = null; } BuildList instance = null; string verVnoDot = String.Format("v{0}", toolsVersion.Remove(1, 1)); string config = String.Format("CSharpTest.Net.CSBuild.{0}.config", verVnoDot); using (TextReader rdr = new StreamReader(typeof(BuildList).Assembly.GetManifestResourceStream(config))) config = rdr.ReadToEnd(); string tmpConfig = Path.Combine(Path.GetTempPath(), String.Format("CSBuild.{0}.config", verVnoDot)); File.WriteAllText(tmpConfig, config); AppDomainSetup setup = new AppDomainSetup(); setup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory; setup.ApplicationName = String.Format("CSBuild - v{0}", toolsVersion); setup.ConfigurationFile = tmpConfig; setup.DisallowBindingRedirects = false; __domain = AppDomain.CreateDomain(setup.ApplicationName, AppDomain.CurrentDomain.Evidence, setup); instance = (BuildList)__domain.CreateInstanceAndUnwrap(typeof(BuildList).Assembly.FullName, typeof(BuildList).FullName); string version = instance.InitRuntime(toolsVersion, frameworkDir, hardReferences); if (toolsVersion == "3.0" && version == "2.0") //these use the same build runtime { version = "3.0"; } if (version != toolsVersion) { throw new ApplicationException(String.Format("Attempt to create build runtime {0} failed (version {1} loaded)", toolsVersion, version)); } global::Log.Info("Using MSBuild Version {0}", version); return(instance); }
public xTargetBuilder(CSBuildConfig config, BuildTarget target, string[] properties) { _config = config; _target = Check.NotNull(target); _build = BuildList.CreateInstance(_target.Toolset.ToString().Insert(2, ".").TrimStart('v'), _target.FrameworkPath, GetReferenceFolders().Length > 0); new TargetBuilderDispatch(this, _build); if (config.Console != null) { _build.SetConsoleLevel(config.Console.Level); } if (_target.TextLog != null) { _build.SetTextLogFile(Environment.CurrentDirectory, _target.TextLog.AbsolutePath, _target.TextLog.Level); } if (_target.XmlLog != null) { _build.SetXmlLogFile(Environment.CurrentDirectory, _target.XmlLog.AbsolutePath, _target.XmlLog.Level); } _build.SetProperty("Configuration", _target.Configuration); _build.SetProperty("Platform", _target.Platform.ToString()); foreach (string property in properties) { string[] values = property.Split(new char [] { '=', ':' }, 2); if (values.Length == 2) { Log.Verbose("Setting property {0} = {1}", values[0], values[1]); _build.SetProperty(values[0], values[1]); } } Log.Info("Using Configuration = {0}", _build.GetProperty("Configuration")); Log.Info("Using Platform = {0}", _build.GetProperty("Platform")); }
public TargetBuilderDispatch(xTargetBuilder inst, BuildList build) : this(inst) { build.ProjectLoaded += ProjectLoaded; }
public TargetBuilderDispatch(xTargetBuilder inst, BuildList build) : this(inst) { build.ProjectLoaded += ProjectLoaded; }