Exemplo n.º 1
0
        string GetAssemblyPath(string assemblyName)
        {
            var parsed = SystemAssemblyService.ParseAssemblyName(assemblyName);

            if (string.IsNullOrEmpty(parsed.Name))
            {
                return(null);
            }

            string localName = Path.Combine(Path.Combine(BaseDirectory, "bin"), parsed.Name + ".dll");

            if (File.Exists(localName))
            {
                return(localName);
            }

            assemblyName = AssemblyContext.GetAssemblyFullName(assemblyName, TargetFramework);
            if (assemblyName == null)
            {
                return(null);
            }
            assemblyName = AssemblyContext.GetAssemblyNameForVersion(assemblyName, TargetFramework);
            if (assemblyName == null)
            {
                return(null);
            }
            return(AssemblyContext.GetAssemblyLocation(assemblyName, TargetFramework));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the file name to an assembly, regardless of what
        /// type the assembly is.
        /// </summary>
        string GetReferencedFileName(ConfigurationSelector configuration)
        {
            switch (ReferenceType)
            {
            case ReferenceType.Assembly:
                return(reference);

            case ReferenceType.Gac:
                string file = AssemblyContext.GetAssemblyLocation(Reference, package, ownerProject != null? ownerProject.TargetFramework : null);
                return(file == null ? reference : file);

            case ReferenceType.Project:
                if (ownerProject != null)
                {
                    if (ownerProject.ParentSolution != null)
                    {
                        Project p = ownerProject.ParentSolution.FindProjectByName(reference);
                        if (p != null)
                        {
                            return(p.GetOutputFileName(configuration));
                        }
                    }
                }
                return(null);

            default:
                Console.WriteLine("pp: " + Reference + " " + OwnerProject.FileName);
                throw new NotImplementedException("unknown reference type : " + ReferenceType);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns the file name to an assembly, regardless of what
        /// type the assembly is.
        /// </summary>
        string GetReferencedFileName(ConfigurationSelector configuration)
        {
            switch (ReferenceType)
            {
            case ReferenceType.Assembly:
                return(hintPath);

            case ReferenceType.Package:
                string file = AssemblyContext.GetAssemblyLocation(Reference, package, ownerProject != null? ownerProject.TargetFramework : null);
                return(file == null ? reference : file);

            case ReferenceType.Project:
                if (ownerProject != null && ownerProject.ParentSolution != null)
                {
                    var p = ResolveProject(ownerProject.ParentSolution);
                    if (p != null)
                    {
                        return(p.GetOutputFileName(configuration));
                    }
                }
                return(null);

            default:
                return(null);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns the file name to an assembly, regardless of what
        /// type the assembly is.
        /// </summary>
        string GetReferencedFileName(ConfigurationSelector configuration)
        {
            switch (ReferenceType)
            {
            case ReferenceType.Assembly:
                return(reference);

            case ReferenceType.Gac:
                string file = AssemblyContext.GetAssemblyLocation(Reference, package, ownerProject != null? ownerProject.TargetFramework : null);
                return(file == null ? reference : file);

            case ReferenceType.Project:
                if (ownerProject != null)
                {
                    if (ownerProject.ParentSolution != null)
                    {
                        Project p = ownerProject.ParentSolution.FindProjectByName(reference);
                        if (p != null)
                        {
                            return(p.GetOutputFileName(configuration));
                        }
                    }
                }
                return(null);

            default:
                return(null);
            }
        }