/// <summary> /// Creates a new CreateOpenRiaClientFilesTask instance to use to generate code /// </summary> /// <param name="relativeTestDir"></param> /// <param name="includeClientOutputAssembly">if <c>true</c> include clients own output assembly in analysis</param> /// <returns>A new task instance that can be invoked to do code gen</returns> public static CreateOpenRiaClientFilesTask CreateOpenRiaClientFilesTaskInstance_CopyClientProjectToOutput(string serverProjectPath, string clientProjectPath, bool includeClientOutputAssembly) { CreateOpenRiaClientFilesTask task = new CreateOpenRiaClientFilesTask(); MockBuildEngine mockBuildEngine = new MockBuildEngine(); task.BuildEngine = mockBuildEngine; task.Language = "C#"; task.ServerProjectPath = serverProjectPath; task.ServerAssemblies = new TaskItem[] { new TaskItem(CodeGenHelper.ServerClassLibOutputAssembly(task.ServerProjectPath)) }; task.ServerReferenceAssemblies = MsBuildHelper.AsTaskItems(CodeGenHelper.ServerClassLibReferences(task.ServerProjectPath)).ToArray(); task.ClientFrameworkPath = CodeGenHelper.GetClientRuntimeDirectory(); // Generate the code to our deployment directory string tempFolder = CodeGenHelper.GenerateTempFolder(); task.OutputPath = Path.Combine(tempFolder, "FileWrites"); task.GeneratedCodePath = Path.Combine(tempFolder, "Generated_Code"); string clientProjectFileName = Path.GetFileName(clientProjectPath); string clientProjectDestPath = Path.Combine(tempFolder, clientProjectFileName); File.Copy(clientProjectPath, clientProjectDestPath); task.ClientProjectPath = clientProjectDestPath; task.ClientReferenceAssemblies = MsBuildHelper.AsTaskItems(CodeGenHelper.ClientClassLibReferences(clientProjectPath, includeClientOutputAssembly)).ToArray(); task.ClientSourceFiles = MsBuildHelper.AsTaskItems(CodeGenHelper.ClientClassLibSourceFiles(clientProjectPath)).ToArray(); return(task); }
/// <summary> /// Creates a new <see cref="ValidateDomainServicesTask"/> instance /// </summary> /// <param name="relativeTestDir">The relative output directory of the test</param> /// <returns>A new <see cref="ValidateDomainServicesTask"/> instance</returns> public static ValidateDomainServicesTask CreateValidateDomainServicesTask(string relativeTestDir) { string deploymentDir = Path.GetDirectoryName(typeof(CodeGenHelper).Assembly.Location); string projectPath = null; string outputPath = null; TestHelper.GetProjectPaths(relativeTestDir, out projectPath, out outputPath); Assert.IsTrue(File.Exists(projectPath), "Could not locate " + projectPath + " necessary for test."); string serverProjectPath = CodeGenHelper.ServerClassLibProjectPath(projectPath); ValidateDomainServicesTask task = new ValidateDomainServicesTask(); MockBuildEngine mockBuildEngine = new MockBuildEngine(); task.BuildEngine = mockBuildEngine; task.ProjectPath = serverProjectPath; task.Assembly = new TaskItem(CodeGenHelper.ServerClassLibOutputAssembly(task.ProjectPath)); task.ReferenceAssemblies = MsBuildHelper.AsTaskItems(CodeGenHelper.ServerClassLibReferences(task.ProjectPath)).ToArray(); return(task); }