public void Test_Serializable() { Project project = CreateEmptyProject(); LicenseTask lt = new LicenseTask(); lt.Parent = project; lt.Project = project; lt.Assemblies.Parent = project; lt.NamespaceManager = project.NamespaceManager; MemoryStream ms = new MemoryStream(); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(ms, lt); }
private FileInfo CompileLicx(Configuration solutionConfiguration) { // create instance of License task LicenseTask lt = new LicenseTask(); // inherit project from solution task lt.Project = _solutionTask.Project; lt.CallStack = _solutionTask.CallStack; // inherit namespace manager from solution task lt.NamespaceManager = _solutionTask.NamespaceManager; // parent is solution task lt.Parent = _solutionTask; // inherit verbose setting from solution task lt.Verbose = _solutionTask.Verbose; // make sure framework specific information is set lt.InitializeTaskConfiguration(); // set parent of child elements lt.Assemblies.Parent = lt; // inherit project from solution task from parent task lt.Assemblies.Project = lt.Project; lt.Assemblies.CallStack = lt.CallStack; // inherit namespace manager from parent task lt.Assemblies.NamespaceManager = lt.NamespaceManager; // set base directory for filesets lt.Assemblies.BaseDirectory = new DirectoryInfo(Path.GetDirectoryName(Project.ProjectPath)); // set task properties lt.InputFile = InputFile; lt.OutputFile = GetCompiledResourceFile(solutionConfiguration); // convert target to uppercase to match VS.NET lt.Target = Path.GetFileName(Project.ProjectSettings.OutputFileName). ToUpper(CultureInfo.InvariantCulture); // inherit assembly references from project foreach (ReferenceBase reference in Project.References) { StringCollection assemblyReferences = reference.GetAssemblyReferences( solutionConfiguration); foreach (string assemblyFile in assemblyReferences) { lt.Assemblies.Includes.Add(assemblyFile); } } // increment indentation level lt.Project.Indent(); try { // execute task lt.Execute(); } finally { // restore indentation level lt.Project.Unindent(); } return(lt.OutputFile); }