예제 #1
0
 public IEnumerable <SystemPackage> GetPackages(TargetFramework fx)
 {
     foreach (SystemPackage pkg in packages)
     {
         if (pkg.TargetFramework == fx.Id)
         {
             yield return(pkg);
         }
         else if (pkg.IsBaseCorePackage)
         {
             if (pkg.TargetFramework == fx.BaseCoreFramework)
             {
                 yield return(pkg);
             }
         }
         else if (pkg.IsFrameworkPackage)
         {
             if (fx.IsCompatibleWithFramework(pkg.TargetFramework))
             {
                 TargetFramework packageFx = Runtime.SystemAssemblyService.GetTargetFramework(pkg.TargetFramework);
                 if (packageFx.BaseCoreFramework == fx.BaseCoreFramework)
                 {
                     yield return(pkg);
                 }
             }
         }
         else if (fx.IsCompatibleWithFramework(pkg.TargetFramework))
         {
             yield return(pkg);
         }
     }
 }
예제 #2
0
		public override bool SupportsFramework (TargetFramework framework)
		{
			if (!framework.IsCompatibleWithFramework (TargetFrameworkMoniker.PORTABLE_4_0))
				return false;
			else
				return base.SupportsFramework (framework);
		}
예제 #3
0
 public override bool SupportsFramework(MonoDevelop.Core.Assemblies.TargetFramework framework)
 {
     if (!framework.IsCompatibleWithFramework (MonoDevelop.Core.Assemblies.TargetFrameworkMoniker.NET_4_0))
         return false;
     else
         return base.SupportsFramework (framework);
 }
예제 #4
0
        // Returns the installed version of the given assembly name
        // (it returns the full name of the installed assembly).
        public string FindInstalledAssembly(string fullname, string package, TargetFramework fx)
        {
            Initialize();
            fullname = NormalizeAsmName(fullname);

            SystemAssembly fasm = GetAssemblyFromFullName(fullname, package, fx);

            if (fasm != null)
            {
                return(fullname);
            }

            // Try to find a newer version of the same assembly, preferring framework assemblies
            if (fx == null)
            {
                string best = null;
                foreach (SystemAssembly asm in FindNewerAssembliesSameName(fullname))
                {
                    if (package == null || asm.Package.Name == package)
                    {
                        if (asm.Package.IsFrameworkPackage)
                        {
                            return(asm.FullName);
                        }
                        else
                        {
                            best = asm.FullName;
                        }
                    }
                }
                return(best);
            }

            string bestMatch = null;

            foreach (SystemAssembly asm in FindNewerAssembliesSameName(fullname))
            {
                if (asm.Package.IsFrameworkPackage)
                {
                    if (fx.IsExtensionOfFramework(asm.Package.TargetFramework))
                    {
                        if (package == null || asm.Package.Name == package)
                        {
                            return(asm.FullName);
                        }
                    }
                }
                else if (fx.IsCompatibleWithFramework(asm.Package.TargetFramework))
                {
                    if (package != null && asm.Package.Name == package)
                    {
                        return(asm.FullName);
                    }
                    bestMatch = asm.FullName;
                }
            }
            return(bestMatch);
        }
예제 #5
0
		public override bool SupportsFramework (TargetFramework framework)
		{
			// DotNetAssemblyProject can only generate assemblies for the regular framework.
			// Special frameworks such as Moonlight or MonoTouch must subclass DotNetProject directly.
			if (!framework.IsCompatibleWithFramework (TargetFrameworkMoniker.NET_1_1))
				return false;
			else
				return base.SupportsFramework (framework);
		}
예제 #6
0
        // Given the full name of an assembly, returns the corresponding full assembly name
        // in the specified target CLR version, or null if it doesn't exist in that version.
        public SystemAssembly GetAssemblyForVersion(string fullName, string packageName, TargetFramework fx)
        {
            Initialize();

            fullName = NormalizeAsmName(fullName);

            //get the SystemAssembly for the current fullname, NOT the new target fx
            //in order to be able to check whether it's a framework assembly
            SystemAssembly asm = GetAssemblyFromFullName(fullName, packageName, null);

            if (asm == null)
            {
                return(null);
            }

            var fxAsms = asm.AllSameName().Where(a => a.Package.IsFrameworkPackage);

            //if the asm is not a framework asm, we don't upgrade it automatically
            if (!fxAsms.Any())
            {
                // Return null if the package is not compatible with the requested version
                if (fx.IsCompatibleWithFramework(asm.Package.TargetFramework))
                {
                    return(asm);
                }
                else
                {
                    return(null);
                }
            }

            foreach (var fxAsm in fxAsms)
            {
                if (fx.IsExtensionOfFramework(fxAsm.Package.TargetFramework))
                {
                    return(fxAsm);
                }
            }

            // We have to find the assembly with the same name in the target fx
            string fname = Path.GetFileName((string)fxAsms.First().Location);

            foreach (var pair in assemblyFullNameToAsm)
            {
                foreach (var fxAsm in pair.Value.AllSameName())
                {
                    var rpack = fxAsm.Package;
                    if (rpack.IsFrameworkPackage && fx.IsExtensionOfFramework(rpack.TargetFramework) && Path.GetFileName(fxAsm.Location) == fname)
                    {
                        return(fxAsm);
                    }
                }
            }
            return(null);
        }
예제 #7
0
        public void StoreCustomData(PcFile pcfile, LibraryPackageInfo pinfo)
        {
            TargetFramework commonFramework        = null;
            bool            inconsistentFrameworks = false;

            foreach (PackageAssemblyInfo pi in pinfo.Assemblies)
            {
                TargetFrameworkMoniker targetFramework = Runtime.SystemAssemblyService.GetTargetFrameworkForAssembly(Runtime.SystemAssemblyService.CurrentRuntime, pi.File);
                if (commonFramework == null)
                {
                    commonFramework = Runtime.SystemAssemblyService.GetCoreFramework(targetFramework);
                    if (commonFramework == null)
                    {
                        inconsistentFrameworks = true;
                    }
                }
                else if (targetFramework != null)
                {
                    TargetFramework newfx = Runtime.SystemAssemblyService.GetCoreFramework(targetFramework);
                    if (newfx == null)
                    {
                        inconsistentFrameworks = true;
                    }
                    else
                    {
                        if (newfx.IsCompatibleWithFramework(commonFramework.Id))
                        {
                            commonFramework = newfx;
                        }
                        else if (!commonFramework.IsCompatibleWithFramework(newfx.Id))
                        {
                            inconsistentFrameworks = true;
                        }
                    }
                }
                if (inconsistentFrameworks)
                {
                    break;
                }
            }
            if (inconsistentFrameworks)
            {
                LoggingService.LogError("Inconsistent target frameworks found in " + pcfile);
            }
            if (commonFramework != null)
            {
                pinfo.SetData("targetFramework", commonFramework.Id.ToString());
            }
            else
            {
                pinfo.SetData("targetFramework", "FxUnknown");
            }
        }
예제 #8
0
 public IEnumerable <SystemPackage> GetPackages(TargetFramework fx)
 {
     foreach (SystemPackage pkg in packages)
     {
         if (pkg.IsFrameworkPackage)
         {
             if (fx.IncludesFramework(pkg.TargetFramework))
             {
                 yield return(pkg);
             }
         }
         else
         {
             if (fx.IsCompatibleWithFramework(pkg.TargetFramework))
             {
                 yield return(pkg);
             }
         }
     }
 }
예제 #9
0
		// Given the full name of an assembly, returns the corresponding full assembly name
		// in the specified target CLR version, or null if it doesn't exist in that version.
		public SystemAssembly GetAssemblyForVersion (string fullName, string packageName, TargetFramework fx)
		{
			Initialize ();

			fullName = NormalizeAsmName (fullName);
			
			//get the SystemAssembly for the current fullname, NOT the new target fx
			//in order to be able to check whether it's a framework assembly
			SystemAssembly asm = GetAssemblyFromFullName (fullName, packageName, null);

			if (asm == null)
				return null;
			
			var fxAsms = asm.AllSameName ().Where (a => a.Package.IsFrameworkPackage);
			
			//if the asm is not a framework asm, we don't upgrade it automatically
			if (!fxAsms.Any ()) {
				// Return null if the package is not compatible with the requested version
				if (fx.IsCompatibleWithFramework (asm.Package.TargetFramework))
					return asm;
				else
					return null;
			}
			
			foreach (var fxAsm in fxAsms) {
				if (fx.IsExtensionOfFramework (fxAsm.Package.TargetFramework))
					return fxAsm;
			}

			// We have to find the assembly with the same name in the target fx
			string fname = Path.GetFileName ((string) fxAsms.First ().Location);
			
			foreach (var pair in assemblyFullNameToAsm) {
				foreach (var fxAsm in pair.Value.AllSameName ()) {
					var rpack = fxAsm.Package;
					if (rpack.IsFrameworkPackage && fx.IsExtensionOfFramework (rpack.TargetFramework) && Path.GetFileName (fxAsm.Location) == fname)
						return fxAsm;
				}
			}
			return null;
		}
예제 #10
0
		// Returns the installed version of the given assembly name
		// (it returns the full name of the installed assembly).
		public string FindInstalledAssembly (string fullname, string package, TargetFramework fx)
		{
			Initialize ();
			fullname = NormalizeAsmName (fullname);
			
			SystemAssembly fasm = GetAssemblyFromFullName (fullname, package, fx);
			if (fasm != null)
				return fullname;
			
			// Try to find a newer version of the same assembly, preferring framework assemblies
			if (fx == null) {
				string best = null;
				foreach (SystemAssembly asm in FindNewerAssembliesSameName (fullname)) {
					if (package == null || asm.Package.Name == package) {
						if (asm.Package.IsFrameworkPackage)
							return asm.FullName;
						else
							best = asm.FullName;
					}
				}
				return best;
			}
			
			string bestMatch = null;
			foreach (SystemAssembly asm in FindNewerAssembliesSameName (fullname)) {
				if (asm.Package.IsFrameworkPackage) {
					if (fx.IsExtensionOfFramework (asm.Package.TargetFramework))
						if (package == null || asm.Package.Name == package)
							return asm.FullName;
				} else if (fx.IsCompatibleWithFramework (asm.Package.TargetFramework)) {
					if (package != null && asm.Package.Name == package)
						return asm.FullName;
					bestMatch = asm.FullName;
				}
			}
			return bestMatch;
		}
예제 #11
0
		public IEnumerable<SystemPackage> GetPackages (TargetFramework fx)
		{
			foreach (SystemPackage pkg in packages) {
				if (pkg.TargetFramework == fx.Id) {
					yield return pkg;
				}
				else if (pkg.IsBaseCorePackage) {
					if (pkg.TargetFramework == fx.BaseCoreFramework)
						yield return pkg;
				}
				else if (pkg.IsFrameworkPackage) {
					if (fx.IsCompatibleWithFramework (pkg.TargetFramework)) {
						TargetFramework packageFx = Runtime.SystemAssemblyService.GetTargetFramework (pkg.TargetFramework);
						if (packageFx.BaseCoreFramework == fx.BaseCoreFramework)
							yield return pkg;
					}
				}
				else if (fx.IsCompatibleWithFramework (pkg.TargetFramework))
					yield return pkg;
			}
		}
예제 #12
0
		public IEnumerable<SystemPackage> GetPackages (TargetFramework fx)
		{
			foreach (SystemPackage pkg in packages) {
				if (pkg.IsFrameworkPackage) {
					if (fx.IncludesFramework (pkg.TargetFramework))
						yield return pkg;
				} else {
					if (fx.IsCompatibleWithFramework (pkg.TargetFramework))
						yield return pkg;
				}		
			}
		}