public TestAssemblyResolver(string targetPath, string projectPath)
        {
            var versionReader = new VersionReader(projectPath);
            this.directories = new List<string>();

            if (versionReader.IsSilverlight)
            {
                if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
                {
                    this.directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\Silverlight\{1}\", this.GetProgramFilesPath(), versionReader.FrameworkVersionAsString));
                }
                else
                {
                    this.directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\Silverlight\{1}\Profile\{2}", this.GetProgramFilesPath(), versionReader.FrameworkVersionAsString, versionReader.TargetFrameworkProfile));
                }
            }
            else
            {
                if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
                {
                    if (versionReader.FrameworkVersionAsNumber == 3.5m)
                    {
                        this.directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.5\", this.GetProgramFilesPath()));
                        this.directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.0\", this.GetProgramFilesPath()));
                        this.directories.Add(Environment.ExpandEnvironmentVariables(@"%WINDIR%\Microsoft.NET\Framework\v2.0.50727\"));
                    }
                    else
                    {
                        this.directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\", this.GetProgramFilesPath(), versionReader.FrameworkVersionAsString));
                    }
                }
                else
                {
                    this.directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\Profile\{2}", this.GetProgramFilesPath(), versionReader.FrameworkVersionAsString, versionReader.TargetFrameworkProfile));
                }
            }
            this.directories.Add(Path.GetDirectoryName(targetPath));

            this.GetGacPaths();

        }
Ejemplo n.º 2
0
        public TestAssemblyResolver(string targetPath, string projectPath)
        {
            var versionReader = new VersionReader(projectPath);

            this.directories = new List <string>();

            if (versionReader.IsSilverlight)
            {
                if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
                {
                    this.directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\Silverlight\{1}\", this.GetProgramFilesPath(), versionReader.FrameworkVersionAsString));
                }
                else
                {
                    this.directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\Silverlight\{1}\Profile\{2}", this.GetProgramFilesPath(), versionReader.FrameworkVersionAsString, versionReader.TargetFrameworkProfile));
                }
            }
            else
            {
                if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
                {
                    if (versionReader.FrameworkVersionAsNumber == 3.5m)
                    {
                        this.directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.5\", this.GetProgramFilesPath()));
                        this.directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.0\", this.GetProgramFilesPath()));
                        this.directories.Add(Environment.ExpandEnvironmentVariables(@"%WINDIR%\Microsoft.NET\Framework\v2.0.50727\"));
                    }
                    else
                    {
                        this.directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\", this.GetProgramFilesPath(), versionReader.FrameworkVersionAsString));
                    }
                }
                else
                {
                    this.directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\Profile\{2}", this.GetProgramFilesPath(), versionReader.FrameworkVersionAsString, versionReader.TargetFrameworkProfile));
                }
            }
            this.directories.Add(Path.GetDirectoryName(targetPath));

            this.GetGacPaths();
        }