Example #1
0
 /// <summary>
 /// Creates a path to the assembly from information stored in given
 /// <see cref="XmlElement"/>.
 /// </summary>
 /// <param name="referenceElement">
 /// <see cref="XmlElement"/> that contains all information needed foe creating a
 /// path.
 /// </param>
 /// <param name="project">         
 /// Reference to the project for which the assembly reference is defined.
 /// </param>
 public AssemblyReference(XmlElement referenceElement, VisualStudioDotNetProject project)
 {
     XmlElement hintPath;
     if (referenceElement.TryGetElement("HintPath", out hintPath))
     {
         this.Path =
             PathUtilities.ToAbsolute(hintPath.FirstChild.Value, project.ProjectFolder);
     }
     else
     {
         XmlElement customTargetFrameworkElement;
         this.Path = ReferenceHelper.GetLocation
         (
             referenceElement.GetAttribute("Include"),
             referenceElement.TryGetElement("RequiredTargetFramework", out customTargetFrameworkElement)
                 ? "v" + customTargetFrameworkElement.FirstChild.Value
                 : project.TargetFramework
         );
     }
 }
Example #2
0
        /// <summary>
        /// Creates a path to the assembly from information stored in given
        /// <see cref="XmlElement"/>.
        /// </summary>
        /// <param name="referenceElement">
        /// <see cref="XmlElement"/> that contains all information needed foe creating a
        /// path.
        /// </param>
        /// <param name="project">
        /// Reference to the project for which the assembly reference is defined.
        /// </param>
        public AssemblyReference(XmlElement referenceElement, VisualStudioDotNetProject project)
        {
            XmlElement hintPath;

            if (referenceElement.TryGetElement("HintPath", out hintPath))
            {
                this.Path =
                    PathUtilities.ToAbsolute(hintPath.FirstChild.Value, project.ProjectFolder);
            }
            else
            {
                XmlElement customTargetFrameworkElement;
                this.Path = ReferenceHelper.GetLocation
                            (
                    referenceElement.GetAttribute("Include"),
                    referenceElement.TryGetElement("RequiredTargetFramework", out customTargetFrameworkElement)
                                                ? "v" + customTargetFrameworkElement.FirstChild.Value
                                                : project.TargetFramework
                            );
            }
        }