Esempio n. 1
0
        /// <summary>
        /// Extract the list of assemblies both generated and referenced by Client.
        /// Not coincidently, this list is what a client project needs to reference.
        /// </summary>
        /// <returns></returns>
        public static List <string> GetClientAssemblies(string relativeTestDir)
        {
            string projectPath = string.Empty;  // path to current project
            string outputPath  = string.Empty;  // output path for current project, used to infer output path of test project

            TestHelper.GetProjectPaths(relativeTestDir, out projectPath, out outputPath);

            // Our current project's folder
            string projectDir = Path.GetDirectoryName(projectPath);

            // Folder of project we want to build
            string testProjectDir = Path.GetFullPath(Path.Combine(projectDir, @"..\..\OpenRiaServices.DomainServices.Client.Web\Framework"));

            string projectOutputDir = Path.Combine(testProjectDir, outputPath);
            string testProjectFile  = Path.Combine(testProjectDir, @"OpenRiaServices.DomainServices.Client.Web.csproj");

            Assert.IsTrue(File.Exists(testProjectFile), "This test could not find its required project at " + testProjectFile);

            // Retrieve all the assembly references from the test project (follows project-to-project references too)
            List <string> assemblies     = MsBuildHelper.GetReferenceAssemblies(testProjectFile);
            string        outputAssembly = MsBuildHelper.GetOutputAssembly(testProjectFile);

            if (!string.IsNullOrEmpty(outputAssembly))
            {
                assemblies.Add(outputAssembly);
            }

            return(assemblies);
        }
Esempio n. 2
0
        /// <summary>
        /// Returns the name of the assembly built by the server project
        /// </summary>
        /// <param name="serverProjectPath"></param>
        /// <returns></returns>
        public static string ServerClassLibOutputAssembly(string serverProjectPath)
        {
            // We need to map any server side assembly references back to our deployment directory
            // if we have the same assembly there, otherwise the assembly load from calls end up
            // with multiple assemblies with the same types
            string deploymentDir = Path.GetDirectoryName(typeof(CodeGenHelper).Assembly.Location);
            string assembly      = MsBuildHelper.GetOutputAssembly(serverProjectPath);

            return(MapAssemblyReferenceToDeployment(deploymentDir, assembly));
        }
Esempio n. 3
0
        /// <summary>
        /// Returns the collection of assembly references from the client project
        /// </summary>
        /// <param name="clientProjectPath"></param>
        /// <returns></returns>
        public static List <string> ClientClassLibReferences(string clientProjectPath, bool includeClientOutputAssembly)
        {
            List <string> references = MsBuildHelper.GetReferenceAssemblies(clientProjectPath);

            // Note: we conditionally add the output assembly to enable this unit test to
            // define some shared types
            if (includeClientOutputAssembly)
            {
                references.Add(MsBuildHelper.GetOutputAssembly(clientProjectPath));
            }

            // Remove mscorlib -- it causes problems using ReflectionOnlyLoad ("parent does not exist")
            for (int i = 0; i < references.Count; ++i)
            {
                if (Path.GetFileName(references[i]).Equals("mscorlib.dll", StringComparison.OrdinalIgnoreCase))
                {
                    references.RemoveAt(i);
                    break;
                }
            }
            return(references);
        }