Beispiel #1
0
        public void AddFileToProject(string fileName)
        {
            //TODO: Make the search hierarchical
            if (project == null)
            {
                return;
            }
            if (!File.Exists(fileName))
            {
                return;
            }
            bool found = false;

            ProjectItems itemCollection = GetItemCollection(fileName);

            foreach (ProjectItem pi in itemCollection)
            {
                if (string.Compare(Path.GetFileName(pi.Name), Path.GetFileName(fileName), true) == 0)
                {
                    found = true;
                    break;
                }
            }
            if (!found)
            {
#if DEBUG
                messageAdapter.WriteLine("  Adding file to project: " + fileName);
#endif
                this.project.DteProject().ProjectItems.AddFromFile(fileName);
            }
        }
Beispiel #2
0
        void IncludeFiles(ConfigurationOptions options, Project project, ProjectDescription projectDescription)
        {
#if DEBUG
            messages.WriteLine("Including project files...");
#endif
            string schemaVersion = string.Empty;
#if DEBUG
            projectDescription.MessageAdapter = messages;
#endif
            string mappingFile = string.Empty;
            try
            {
#if DEBUG
                messages.WriteLine("  mapping...");
#endif
                mappingFile = project.DefaultMappingFileName();
                projectDescription.AddFileToProject(mappingFile);
            }
            catch (Exception ex)
            {
                messages.WriteLine("Warning: Can't add mapping file '" + mappingFile + "' to the project. " + ex.Message);
            }
            try
            {
                NDOMapping mapping = new NDOMapping(mappingFile);
                schemaVersion = mapping.SchemaVersion;
            }
            catch (Exception ex)
            {
                messages.WriteLine("Warning: Can't extract schema version from the mapping file. Error message: " + ex.Message);
            }

#if DEBUG
            messages.WriteLine("...ready");
#endif
        }