private BuildItem FindByReference(ProjectRef reference)
 {
     if (reference.Guid.HasValue)
     {
         foreach (BuildItem bi in _project.GetEvaluatedItemsByName("ProjectReference").ToArray())
         {
             if (reference.Guid == new Guid(bi.GetMetadata("Project")))
             {
                 return(bi);
             }
         }
     }
     else if (reference.Assembly != null)
     {
         //Now we enum all the real Reference items...
         foreach (BuildItem bi in _project.GetEvaluatedItemsByName("Reference").ToArray())
         {
             if (reference.Assembly.Name == new AssemblyName(bi.Include).Name)
             {
                 return(bi);
             }
         }
     }
     return(null);
 }
Exemplo n.º 2
0
        public override bool Equals(object obj)
        {
            ProjectRef other = obj as ProjectRef;

            if (other == null)
            {
                return(false);
            }

            return(
                GetHashCode() == other.GetHashCode() &&
                RefType == other.RefType &&
                Guid == other.Guid &&
                Condition == other.Condition &&
                Assembly == other.Assembly
                );
        }
		public bool RemoveReference(ProjectRef reference)
		{
			if (_refCache != null)
				_refCache.Remove(reference);

			Log.Verbose("Removing reference to: {0}", reference.Assembly);
            BuildItem bi = FindByReference(reference);
            if (bi != null)
            {
                _project.RemoveItem(bi);
                Log.Verbose("Removed reference to: {0}", reference.Assembly);
                return true;
            }

            Log.Warning("Don't know how to remove reference: {0}", reference.Assembly);
			return false;
		}
        public void ResolveReference(ProjectRef reference, string hintPath, bool copyLocal, bool specificVersion)
		{
			_allowed[reference.Assembly] = true;
            BuildItem bi = FindByReference(reference);
            if (bi == null)
                Log.Error("Unable to locate reference: {0}", reference.Assembly);
            if (bi.Name != "Reference")
            {
                bi.Name = "Reference";
                bi.RemoveMetadata("Project");
            }
            if(specificVersion && File.Exists(hintPath))
                bi.Include = System.Reflection.AssemblyName.GetAssemblyName(hintPath).FullName;
            bi.SetMetadata("HintPath", MakeProjectRelativePath(hintPath));
            bi.SetMetadata("SpecificVersion", specificVersion.ToString());
            bi.SetMetadata("Private", copyLocal.ToString());
		}
        public bool RemoveReference(ProjectRef reference)
        {
            if (_refCache != null)
            {
                _refCache.Remove(reference);
            }

            Log.Verbose("Removing reference to: {0}", reference.Assembly);
            BuildItem bi = FindByReference(reference);

            if (bi != null)
            {
                _project.RemoveItem(bi);
                Log.Verbose("Removed reference to: {0}", reference.Assembly);
                return(true);
            }

            Log.Warning("Don't know how to remove reference: {0}", reference.Assembly);
            return(false);
        }
        public void ResolveReference(ProjectRef reference, string hintPath, bool copyLocal, bool specificVersion)
        {
            _allowed[reference.Assembly] = true;
            BuildItem bi = FindByReference(reference);

            if (bi == null)
            {
                Log.Error("Unable to locate reference: {0}", reference.Assembly);
            }
            if (bi.Name != "Reference")
            {
                bi.Name = "Reference";
                bi.RemoveMetadata("Project");
            }
            if (specificVersion && File.Exists(hintPath))
            {
                bi.Include = System.Reflection.AssemblyName.GetAssemblyName(hintPath).FullName;
            }
            bi.SetMetadata("HintPath", MakeProjectRelativePath(hintPath));
            bi.SetMetadata("SpecificVersion", specificVersion.ToString());
            bi.SetMetadata("Private", copyLocal.ToString());
        }
Exemplo n.º 7
0
        public ProjectInfo FindItem(ProjectRef reference)
        {
            int itemIx;

            if (reference.Guid.HasValue && _byProjectId.TryGetValue(reference.Guid.Value, out itemIx))
            {
                return(_projects[itemIx].BuildItem);
            }
            if (reference.Project != null && _byProject.TryGetValue(reference.Project, out itemIx))
            {
                return(_projects[itemIx].BuildItem);
            }
            if (reference.Output != null && _byOutputFile.TryGetValue(reference.Output, out itemIx))
            {
                return(_projects[itemIx].BuildItem);
            }
            if (reference.Assembly != null && _byAssembly.TryGetValue(reference.Assembly.Name, out itemIx))
            {
                return(_projects[itemIx].BuildItem);
            }
            return(null);
        }
Exemplo n.º 8
0
 public ProjectInfo GetReference(ProjectRef reference)
 {
     return(_items.FindItem(reference));
 }
 private BuildItem FindByReference(ProjectRef reference)
 {
     if (reference.Guid.HasValue)
     {
         foreach (BuildItem bi in _project.GetEvaluatedItemsByName("ProjectReference").ToArray())
         {
             if (reference.Guid == new Guid(bi.GetMetadata("Project")))
                 return bi;
         }
     }
     else if (reference.Assembly != null)
     {
         //Now we enum all the real Reference items...
         foreach (BuildItem bi in _project.GetEvaluatedItemsByName("Reference").ToArray())
         {
             if (reference.Assembly.Name == new AssemblyName(bi.Include).Name)
                 return bi;
         }
     }
     return null;
 }
Exemplo n.º 10
0
		public ProjectInfo GetReference(ProjectRef reference)
		{
			return _items.FindItem(reference);
		}