Inheritance: NAnt.Core.Element
Exemple #1
0
        private void PerformInit()
        {
            // get framework-specific project node
            XmlNode projectNode = _frameworkNode.SelectSingleNode("nant:project",
                NamespaceManager);

            if (projectNode == null)
                throw new ArgumentException("No <project> node is defined.");

            // create XmlDocument from project node
            XmlDocument projectDoc = new XmlDocument();
            projectDoc.LoadXml(projectNode.OuterXml);

            // create and execute project
            Project frameworkProject = new Project(projectDoc);
            frameworkProject.BaseDirectory = AppDomain.CurrentDomain.BaseDirectory;
            frameworkProject.Execute();

            XmlNode runtimeNode = _frameworkNode.SelectSingleNode ("runtime",
                NamespaceManager);
            if (runtimeNode != null) {
                _runtime = new Runtime ();
                _runtime.Parent = _runtime.Project = frameworkProject;
                _runtime.NamespaceManager = NamespaceManager;
                _runtime.Initialize(runtimeNode, frameworkProject.Properties, this);
            }

            string sdkDir = GetXmlAttributeValue(_frameworkNode, "sdkdirectory");
            try {
                sdkDir = frameworkProject.ExpandProperties(sdkDir,
                    Location.UnknownLocation);
            } catch (BuildException) {
                // do nothing with this exception as a framework is still
                // considered valid if the sdk directory is not available
                // or not configured correctly
            }

            // the sdk directory does not actually have to exist for a
            // framework to be considered valid
            if (sdkDir != null && Directory.Exists(sdkDir))
                _sdkDirectory = new DirectoryInfo(sdkDir);

            _project = frameworkProject;
            _status = InitStatus.Initialized;
        }
Exemple #2
0
        protected FrameworkInfo(SerializationInfo info, StreamingContext context)
        {
            _name = info.GetString("Name");
            _family = info.GetString("Family");
            _description = info.GetString("Description");
            _status = (InitStatus) info.GetValue("Status", typeof(InitStatus));
            _clrType = (ClrType) info.GetValue("ClrType", typeof(ClrType));
            _version = (Version) info.GetValue("Version", typeof(Version));
            _clrVersion = (Version) info.GetValue("ClrVersion", typeof(Version));
            _vendor = (VendorType) info.GetValue("Vendor", typeof(VendorType));
            if (_status != InitStatus.Valid) {
                return;
            }

            _frameworkDirectory = (DirectoryInfo) info.GetValue("FrameworkDirectory", typeof(DirectoryInfo));
            _sdkDirectory = (DirectoryInfo) info.GetValue("SdkDirectory", typeof(DirectoryInfo));
            _frameworkAssemblyDirectory = (DirectoryInfo) info.GetValue("FrameworkAssemblyDirectory", typeof(DirectoryInfo));
            _runtime = (Runtime) info.GetValue("Runtime", typeof(Runtime));
            _project = (Project) info.GetValue("Project", typeof(Project));
            _taskAssemblies = (FileSet) info.GetValue("TaskAssemblies", typeof(FileSet));
            _referenceAssemblies = (FileSet[]) info.GetValue("ReferenceAssemblies", typeof(FileSet[]));
            _toolPaths = (string[]) info.GetValue("ToolPaths", typeof(string[]));
        }