public ExportSolutionDialog(WorkspaceItem item, FileFormat selectedFormat)
        {
            this.Build();

            labelNewFormat.Text = item.FileFormat.Name;

            formats = Services.ProjectService.FileFormats.GetFileFormatsForObject (item);
            foreach (FileFormat format in formats)
                comboFormat.AppendText (format.Name);

            int sel = Array.IndexOf (formats, selectedFormat);
            if (sel == -1) sel = 0;
            comboFormat.Active = sel;

            if (formats.Length < 2) {
                table.Remove (newFormatLabel);
                newFormatLabel.Destroy ();
                newFormatLabel = null;
                table.Remove (comboFormat);
                comboFormat.Destroy ();
                comboFormat = null;
            }

            //auto height
            folderEntry.WidthRequest = 380;
            Resize (1, 1);

            folderEntry.Path = item.ItemDirectory;
            UpdateControls ();
        }
		public override TargetFrameworkMoniker GetDefaultTargetFrameworkForFormat (FileFormat format)
		{
			// Note: This value is used only when serializing the TargetFramework to the .csproj file.
			// Any component of the TargetFramework that is different from this base TargetFramework
			// value will be serialized.
			//
			// Therefore, if we only specify the TargetFrameworkIdentifier, then both the
			// TargetFrameworkVersion and TargetFrameworkProfile values will be serialized.
			return new TargetFrameworkMoniker (".NETPortable", "1.0");
		}
		public override bool SupportsFormat (FileFormat format)
		{
			int version;
			
			if (!format.Id.StartsWith ("MSBuild"))
				return false;
			
			if (!int.TryParse (format.Id.Substring ("MSBuild".Length), out version))
				return false;
			
			return version >= 10;
		}
		public override TargetFrameworkMoniker GetDefaultTargetFrameworkForFormat (FileFormat format)
		{
			switch (format.Id) {
			case "MSBuild05":
				return TargetFrameworkMoniker.NET_2_0;
			case "MSBuild08":
				return TargetFrameworkMoniker.NET_2_0;
			case "MSBuild10":
				return TargetFrameworkMoniker.NET_4_0;
			}
			return Services.ProjectService.DefaultTargetFramework.Id;
		}
		public ExportProjectDialog (IWorkspaceObject entry, FileFormat selectedFormat)
		{
			this.Build();
			
			FileFormat f = entry is WorkspaceItem ? ((WorkspaceItem)entry).FileFormat : ((SolutionEntityItem)entry).FileFormat;
			labelNewFormat.Text = f.Name;
			
			formats = Services.ProjectService.FileFormats.GetFileFormatsForObject (entry);
			foreach (FileFormat format in formats)
				comboFormat.AppendText (format.Name);

			int sel = Array.IndexOf (formats, selectedFormat);
			if (sel == -1) sel = 0;
			comboFormat.Active = sel;
			
			folderEntry.Path = entry.ItemDirectory;
			UpdateControls ();
		}
		public SourcesZipEditorWidget (PackageBuilder target, FileFormat selectedFormat)
		{
			this.Build();
			this.target = (SourcesZipPackageBuilder) target;
			loading = true;
			
			if (target.RootSolutionItem is SolutionFolder)
				formats = Services.ProjectService.FileFormats.GetFileFormatsForObject (target.Solution);
			else
				formats = Services.ProjectService.FileFormats.GetFileFormatsForObject (target.RootSolutionItem);
			
			if (selectedFormat == null) selectedFormat = this.target.FileFormat;
			if (selectedFormat == null)
				selectedFormat = formats [0];
			
			int sel = 0;
			for (int n=0; n<formats.Length; n++) {
				comboFormat.AppendText (formats[n].Name);
				if (formats[n].Name == selectedFormat.Name)
					sel = n;
			}

			comboFormat.Active = sel;
			this.target.FileFormat = formats [sel];
			
			string[] archiveFormats = DeployService.SupportedArchiveFormats;
			int zel = 1;
			for (int n=0; n<archiveFormats.Length; n++) {
				comboZip.AppendText (archiveFormats [n]);
				if (this.target.TargetFile.EndsWith (archiveFormats [n]))
					zel = n;
			}
			
			if (!string.IsNullOrEmpty (this.target.TargetFile)) {
				string ext = archiveFormats [zel];
				folderEntry.Path = System.IO.Path.GetDirectoryName (this.target.TargetFile);
				entryZip.Text = System.IO.Path.GetFileName (this.target.TargetFile.Substring (0, this.target.TargetFile.Length - ext.Length));
				comboZip.Active = zel;
			}
			loading = false;
		}
Example #7
0
		FilePath WriteFile (IProgressMonitor monitor, FilePath file, object item, FileFormat format)
		{
			if (format == null) {
				if (defaultFormat.CanWrite (item))
					format = defaultFormat;
				else {
					FileFormat[] formats = formatManager.GetFileFormatsForObject (item);
					format = formats.Length > 0 ? formats [0] : null;
				}
				
				if (format == null)
					return null;

				file = format.GetValidFileName (item, file);
			}
			
			FileService.RequestFileEdit (file);

			format.Format.WriteFile (file, item, monitor);
			return file;
		}
Example #8
0
        public int Run(string[] arguments)
        {
            if (arguments.Length == 0 || arguments [0] == "--help")
            {
                Console.WriteLine("");
                Console.WriteLine("Project Export Tool");
                Console.WriteLine("Usage: mdtool project-export <source-project-file> [-d:dest-path] [-f:format-name]");
                Console.WriteLine("");
                Console.WriteLine("Options");
                Console.WriteLine("  -d:<dest-path>      Directory where the project will be exported.");
                Console.WriteLine("  -f:\"<format-name>\"  Format to which export the project or solution.");
                Console.WriteLine("  -l                  Show a list of all allowed target formats.");
                Console.WriteLine("  -p:<project-name>   When exporting a solution, name of a project to be");
                Console.WriteLine("                      included in the export. It can be specified multiple");
                Console.WriteLine("                      times.");
                Console.WriteLine("");
                Console.WriteLine("  The format name is optional. A list of allowed file formats will be");
                Console.WriteLine("  shown if none is provided.");
                Console.WriteLine("");
                return(0);
            }

            string        projectFile = null;
            string        destPath    = null;
            string        formatName  = null;
            bool          formatList  = false;
            List <string> projects    = new List <string> ();

            string[] itemsToExport = null;

            foreach (string s in arguments)
            {
                if (s.StartsWith("-d:"))
                {
                    destPath = s.Substring(3);
                }
                else if (s.StartsWith("-f:"))
                {
                    formatName = s.Substring(3);
                }
                else if (s.StartsWith("-p:"))
                {
                    projects.Add(s.Substring(3));
                }
                else if (s == "-l")
                {
                    formatList = true;
                }
                else if (projectFile != null)
                {
                    Console.WriteLine("Only one project can be converted at a time.");
                    return(1);
                }
                else
                {
                    projectFile = s;
                }
            }

            if (projectFile == null)
            {
                Console.WriteLine("Project or solution file name not provided.");
                return(1);
            }

            projectFile = FileService.GetFullPath(projectFile);
            if (!File.Exists(projectFile))
            {
                Console.WriteLine("File {0} not found.", projectFile);
                return(1);
            }

            ConsoleProgressMonitor monitor = new ConsoleProgressMonitor();

            monitor.IgnoreLogMessages = true;


            object item;

            if (Services.ProjectService.IsWorkspaceItemFile(projectFile))
            {
                item = Services.ProjectService.ReadWorkspaceItem(monitor, projectFile);
                if (projects.Count > 0)
                {
                    Solution sol = item as Solution;
                    if (sol == null)
                    {
                        Console.WriteLine("The -p option can only be used when exporting a solution.");
                        return(1);
                    }
                    for (int n = 0; n < projects.Count; n++)
                    {
                        string pname = projects [n];
                        if (pname.Length == 0)
                        {
                            Console.WriteLine("Project name not specified in -p option.");
                            return(1);
                        }
                        Project p = sol.FindProjectByName(pname);
                        if (p == null)
                        {
                            Console.WriteLine("Project '" + pname + "' not found in solution.");
                            return(1);
                        }
                        projects[n] = p.ItemId;
                    }
                    itemsToExport = projects.ToArray();
                }
            }
            else
            {
                if (projects.Count > 0)
                {
                    Console.WriteLine("The -p option can't be used when exporting a single project");
                    return(1);
                }
                item = Services.ProjectService.ReadSolutionItem(monitor, projectFile);
            }

            FileFormat[] formats = Services.ProjectService.FileFormats.GetFileFormatsForObject(item);

            if (formats.Length == 0)
            {
                Console.WriteLine("Can't convert file to any format: " + projectFile);
                return(1);
            }

            FileFormat format = null;

            if (formatName == null || formatList)
            {
                Console.WriteLine();
                Console.WriteLine("Target formats:");
                for (int n = 0; n < formats.Length; n++)
                {
                    Console.WriteLine("  {0}. {1}", n + 1, formats [n].Name);
                }
                Console.WriteLine();
                if (formatList)
                {
                    return(0);
                }

                int op = 0;
                do
                {
                    Console.Write("Convert to format: ");
                    string s = Console.ReadLine();
                    if (s.Length == 0)
                    {
                        return(1);
                    }
                    if (int.TryParse(s, out op))
                    {
                        if (op > 0 && op <= formats.Length)
                        {
                            break;
                        }
                    }
                } while (true);

                format = formats [op - 1];
            }
            else
            {
                foreach (FileFormat f in formats)
                {
                    if (f.Name == formatName)
                    {
                        format = f;
                    }
                }
                if (format == null)
                {
                    Console.WriteLine("Unknown file format: " + formatName);
                    return(1);
                }
            }

            if (destPath == null)
            {
                destPath = Path.GetDirectoryName(projectFile);
            }
            destPath = FileService.GetFullPath(destPath);

            string ofile = Services.ProjectService.Export(monitor, projectFile, itemsToExport, destPath, format);

            if (ofile != null)
            {
                Console.WriteLine("Saved file: " + ofile);
                return(0);
            }
            else
            {
                Console.WriteLine("Project export failed.");
                return(1);
            }
        }
Example #9
0
        public string Export(IProgressMonitor monitor, string rootSourceFile, string[] includedChildIds, string targetPath, FileFormat format)
        {
            IWorkspaceFileObject obj;

            if (IsWorkspaceItemFile(rootSourceFile))
            {
                obj = ReadWorkspaceItem(monitor, rootSourceFile) as Solution;
            }
            else
            {
                obj = ReadSolutionItem(monitor, rootSourceFile);
                if (obj == null)
                {
                    throw new InvalidOperationException("File is not a solution or project.");
                }
            }
            using (obj) {
                return(Export(monitor, obj, includedChildIds, targetPath, format));
            }
        }
Example #10
0
		object ReadFile (IProgressMonitor monitor, string file, Type expectedType, out FileFormat format)
		{
			FileFormat[] formats = formatManager.GetFileFormats (file, expectedType);

			if (formats.Length == 0)
				throw new InvalidOperationException ("Unknown file format: " + file);
			
			format = formats [0];
			object obj = format.Format.ReadFile (file, expectedType, monitor);
			if (obj == null)
				throw new InvalidOperationException ("Invalid file format: " + file);

			return obj;
		}
		static void SetClosestSupportedTargetFramework (FileFormat format, DotNetProject project)
		{
			// If the solution format can't write this project due to an unsupported framework, try finding the
			// closest valid framework. DOn't worry about whether it's installed, that's up to the user to correct.
			TargetFramework curFx = project.TargetFramework;
			var candidates = Runtime.SystemAssemblyService.GetTargetFrameworks ()
				.Where (fx =>
					//only frameworks with the same ID, else version comparisons are meaningless
					fx.Id.Identifier == curFx.Id.Identifier &&
					//don't consider profiles, only full frameworks
					fx.Id.Profile == null &&
					//and the project and format must support the framework
					project.SupportsFramework (fx) && format.SupportsFramework (fx))
					//FIXME: string comparisons aren't a valid way to compare profiles, but it works w/released .NET versions
				.OrderBy (fx => fx.Id.Version)
				.ToList ();
			
			TargetFramework newFx =
				candidates.FirstOrDefault (fx => string.CompareOrdinal (fx.Id.Version, curFx.Id.Version) > 0)
				 ?? candidates.LastOrDefault ();
			
			if (newFx != null)
				project.TargetFramework = newFx;
		}
		public void TryFixingFramework (FileFormat format, DotNetProject item)
		{
			// If the solution format can't write this project it may be due to an unsupported
			// framework. Try finding a compatible framework.

			TargetFramework curFx = item.TargetFramework;
			foreach (TargetFramework fx in Runtime.SystemAssemblyService.GetTargetFrameworks ()) {
				item.TargetFramework = fx;
				if (format.CanWrite (item))
					return;
			}
			item.TargetFramework = curFx;
		}
Example #13
0
 public virtual bool SupportsFormat(FileFormat format)
 {
     return(true);
 }
		public override void CopyFrom (PackageBuilder other)
		{
			base.CopyFrom (other);
			SourcesZipPackageBuilder builder = (SourcesZipPackageBuilder) other;
			targetFile = builder.targetFile;
			format = builder.format;
			fileFormat = builder.fileFormat;
		}
		public override void InitializeSettings (SolutionItem entry)
		{
			targetFile = Path.Combine (entry.BaseDirectory, entry.Name) + ".tar.gz";
			if (entry.ParentSolution != null)
				fileFormat = entry.ParentSolution.FileFormat;
		}
		public override TargetFrameworkMoniker GetDefaultTargetFrameworkForFormat(FileFormat format)
		{
			//Keep default version invalid(1.0) or MonoDevelop will omit from serialization
			return new TargetFrameworkMoniker(".NETMicroFramework", "1.0");
		}
Example #17
0
		internal ProjectService ()
		{
			AddinManager.AddExtensionNodeHandler (FileFormatsExtensionPath, OnFormatExtensionChanged);
			AddinManager.AddExtensionNodeHandler (SerializableClassesExtensionPath, OnSerializableExtensionChanged);
			AddinManager.AddExtensionNodeHandler (ExtendedPropertiesExtensionPath, OnPropertiesExtensionChanged);
			AddinManager.AddExtensionNodeHandler (ProjectBindingsExtensionPath, OnProjectsExtensionChanged);
			AddinManager.ExtensionChanged += OnExtensionChanged;
			
			defaultFormat = formatManager.GetFileFormat (MSBuildProjectService.DefaultFormat);
		}
Example #18
0
		public void RegisterFileFormat (IFileFormat format, string id, string name, bool canDefault)
		{
			FileFormat f = new FileFormat (format, id, name, canDefault);
			fileFormats.Add (f);
		}
Example #19
0
        string Export(IProgressMonitor monitor, IWorkspaceFileObject obj, string[] includedChildIds, string targetPath, FileFormat format)
        {
            string rootSourceFile = obj.FileName;
            string sourcePath     = Path.GetFullPath(Path.GetDirectoryName(rootSourceFile));

            targetPath = Path.GetFullPath(targetPath);

            if (sourcePath != targetPath)
            {
                if (!CopyFiles(monitor, obj, obj.GetItemFiles(true), targetPath, true))
                {
                    return(null);
                }

                string newFile = Path.Combine(targetPath, Path.GetFileName(rootSourceFile));
                if (IsWorkspaceItemFile(rootSourceFile))
                {
                    obj = ReadWorkspaceItem(monitor, newFile);
                }
                else
                {
                    obj = (SolutionEntityItem)ReadSolutionItem(monitor, newFile);
                }

                using (obj) {
                    List <FilePath> oldFiles = obj.GetItemFiles(true);
                    ExcludeEntries(obj, includedChildIds);
                    if (format != null)
                    {
                        obj.ConvertToFormat(format, true);
                    }
                    obj.Save(monitor);
                    List <FilePath> newFiles = obj.GetItemFiles(true);

                    foreach (FilePath f in newFiles)
                    {
                        if (!f.IsChildPathOf(targetPath))
                        {
                            if (obj is Solution)
                            {
                                monitor.ReportError("The solution '" + obj.Name + "' is referencing the file '" + f.FileName + "' which is located outside the root solution directory.", null);
                            }
                            else
                            {
                                monitor.ReportError("The project '" + obj.Name + "' is referencing the file '" + f.FileName + "' which is located outside the project directory.", null);
                            }
                        }
                        oldFiles.Remove(f);
                    }

                    // Remove old files
                    foreach (FilePath file in oldFiles)
                    {
                        if (File.Exists(file))
                        {
                            File.Delete(file);

                            // Exclude empty directories
                            FilePath dir = file.ParentDirectory;
                            if (Directory.GetFiles(dir).Length == 0 && Directory.GetDirectories(dir).Length == 0)
                            {
                                try {
                                    Directory.Delete(dir);
                                } catch (Exception ex) {
                                    monitor.ReportError(null, ex);
                                }
                            }
                        }
                    }
                    return(obj.FileName);
                }
            }
            else
            {
                using (obj) {
                    ExcludeEntries(obj, includedChildIds);
                    if (format != null)
                    {
                        obj.ConvertToFormat(format, true);
                    }
                    obj.Save(monitor);
                    return(obj.FileName);
                }
            }
        }
 void IWorkspaceFileObject.ConvertToFormat(FileFormat format, bool convertChildren)
 {
     this.FileFormat = format;
 }
		public void Export (IWorkspaceObject entry, FileFormat format)
		{
			ExportProjectDialog dlg = new ExportProjectDialog (entry, format);
			try {
				if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
					
					using (IProgressMonitor mon = IdeApp.Workbench.ProgressMonitors.GetToolOutputProgressMonitor (true)) {
						string folder = dlg.TargetFolder;
						
						string file = entry is WorkspaceItem ? ((WorkspaceItem)entry).FileName : ((SolutionEntityItem)entry).FileName;
						Services.ProjectService.Export (mon, file, folder, dlg.Format);
					}
				}
			} finally {
				dlg.Destroy ();
			}
		}
		public override TargetFrameworkMoniker GetDefaultTargetFrameworkForFormat (FileFormat format)
		{
			return new TargetFrameworkMoniker("4.0");
		}
 internal protected override Task OnSave(ProgressMonitor monitor)
 {
     return(FileFormat.WriteFile(FileName, this, monitor));
 }
Example #24
0
		public string Export (IProgressMonitor monitor, string rootSourceFile, string targetPath, FileFormat format)
		{
			rootSourceFile = GetTargetFile (rootSourceFile);
			return Export (monitor, rootSourceFile, null, targetPath, format);
		}
Example #25
0
		public override bool SupportsFormat (FileFormat format)
		{
			return format.Id == "MSBuild10";
		}
Example #26
0
		string Export (IProgressMonitor monitor, IWorkspaceFileObject obj, string[] includedChildIds, string targetPath, FileFormat format)
		{
			string rootSourceFile = obj.FileName;
			string sourcePath = Path.GetFullPath (Path.GetDirectoryName (rootSourceFile));
			targetPath = Path.GetFullPath (targetPath);
			
			if (sourcePath != targetPath) {
				if (!CopyFiles (monitor, obj, obj.GetItemFiles (true), targetPath, true))
					return null;
				
				string newFile = Path.Combine (targetPath, Path.GetFileName (rootSourceFile));
				if (IsWorkspaceItemFile (rootSourceFile))
					obj = ReadWorkspaceItem (monitor, newFile);
				else
					obj = (SolutionEntityItem) ReadSolutionItem (monitor, newFile);
				
				using (obj) {
					List<FilePath> oldFiles = obj.GetItemFiles (true);
					ExcludeEntries (obj, includedChildIds);
					if (format != null)
						obj.ConvertToFormat (format, true);
					obj.Save (monitor);
					List<FilePath> newFiles = obj.GetItemFiles (true);
					
					foreach (FilePath f in newFiles) {
						if (!f.IsChildPathOf (targetPath)) {
							if (obj is Solution)
								monitor.ReportError ("The solution '" + obj.Name + "' is referencing the file '" + f.FileName + "' which is located outside the root solution directory.", null);
							else
								monitor.ReportError ("The project '" + obj.Name + "' is referencing the file '" + f.FileName + "' which is located outside the project directory.", null);
						}
						oldFiles.Remove (f);
					}
	
					// Remove old files
					foreach (FilePath file in oldFiles) {
						if (File.Exists (file)) {
							File.Delete (file);
						
							// Exclude empty directories
							FilePath dir = file.ParentDirectory;
							if (Directory.GetFiles (dir).Length == 0 && Directory.GetDirectories (dir).Length == 0) {
								try {
									Directory.Delete (dir);
								} catch (Exception ex) {
									monitor.ReportError (null, ex);
								}
							}
						}
					}
					return obj.FileName;
				}
			}
			else {
				using (obj) {
					ExcludeEntries (obj, includedChildIds);
					if (format != null)
						obj.ConvertToFormat (format, true);
					obj.Save (monitor);
					return obj.FileName;
				}
			}
		}
Example #27
0
		/// <summary>
		/// Returns the default framework for a given format
		/// </summary>
		/// <returns>
		/// The default target framework for the format.
		/// </returns>
		/// <param name='format'>
		/// A format
		/// </param>
		/// <remarks>
		/// This method is used to determine what's the correct target framework for a project
		/// deserialized using a specific format.
		/// </remarks>
		public virtual TargetFrameworkMoniker GetDefaultTargetFrameworkForFormat (FileFormat format)
		{
			return GetDefaultTargetFrameworkId ();
		}
Example #28
0
		internal ProjectService ()
		{
			extensionChainSlot = Thread.AllocateDataSlot ();
			AddinManager.AddExtensionNodeHandler (FileFormatsExtensionPath, OnFormatExtensionChanged);
			AddinManager.AddExtensionNodeHandler (SerializableClassesExtensionPath, OnSerializableExtensionChanged);
			AddinManager.AddExtensionNodeHandler (ExtendedPropertiesExtensionPath, OnPropertiesExtensionChanged);
			AddinManager.AddExtensionNodeHandler (ProjectBindingsExtensionPath, OnProjectsExtensionChanged);
			AddinManager.ExtensionChanged += OnExtensionChanged;
			
			defaultFormat = formatManager.GetFileFormat ("MSBuild05");
		}
Example #29
0
		string WriteFile (IProgressMonitor monitor, string file, object item, FileFormat format)
		{
			if (format == null) {
				if (defaultFormat.CanWrite (item))
					format = defaultFormat;
				else {
					FileFormat[] formats = formatManager.GetFileFormatsForObject (item);
					format = formats.Length > 0 ? formats [0] : null;
				}
				
				if (format == null)
					return null;
				file = format.GetValidFileName (item, file);
			}
			
			if (!FileService.RequestFileEdit (file))
				throw new UserException (GettextCatalog.GetString ("The project could not be saved"), GettextCatalog.GetString ("Write permission has not been granted for file '{0}'", file));
			
			format.Format.WriteFile (file, item, monitor);
			return file;
		}
Example #30
0
 public string Export(IProgressMonitor monitor, string rootSourceFile, string targetPath, FileFormat format)
 {
     rootSourceFile = GetTargetFile(rootSourceFile);
     return(Export(monitor, rootSourceFile, null, targetPath, format));
 }
Example #31
0
		public string Export (IProgressMonitor monitor, string rootSourceFile, string[] includedChildIds, string targetPath, FileFormat format)
		{
			IWorkspaceFileObject obj;
			
			if (IsWorkspaceItemFile (rootSourceFile)) {
				obj = ReadWorkspaceItem (monitor, rootSourceFile) as Solution;
			} else {
				obj = ReadSolutionItem (monitor, rootSourceFile);
				if (obj == null)
					throw new InvalidOperationException ("File is not a solution or project.");
			}
			using (obj) {
				return Export (monitor, obj, includedChildIds, targetPath, format);
			}
		}
		public void RegisterFileFormat (IFileFormat format, string id, string name)
		{
			FileFormat f = new FileFormat (format, id, name);
			fileFormats.Add (f);
		}
Example #33
0
		public Solution GetWrapperSolution (IProgressMonitor monitor, string filename)
		{
			// First of all, check if a solution with the same name already exists
			
			FileFormat[] formats = Services.ProjectService.FileFormats.GetFileFormats (filename, typeof(SolutionEntityItem));
			if (formats.Length == 0)
				formats = new FileFormat [] { DefaultFileFormat };
			
			Solution tempSolution = new Solution ();
			
			FileFormat solutionFileFormat;
			if (formats [0].CanWrite (tempSolution))
				solutionFileFormat = formats [0];
			else
				solutionFileFormat = MonoDevelop.Projects.Formats.MD1.MD1ProjectService.FileFormat;
			
			string solFileName = solutionFileFormat.GetValidFileName (tempSolution, filename);
			
			if (File.Exists (solFileName)) {
				return (Solution) Services.ProjectService.ReadWorkspaceItem (monitor, solFileName);
			}
			else {
				// Create a temporary solution and add the project to the solution
				tempSolution.SetLocation (Path.GetDirectoryName (filename), Path.GetFileNameWithoutExtension (filename));
				SolutionEntityItem sitem = Services.ProjectService.ReadSolutionItem (monitor, filename);
				tempSolution.ConvertToFormat (solutionFileFormat, false);
				tempSolution.RootFolder.Items.Add (sitem);
				tempSolution.CreateDefaultConfigurations ();
				tempSolution.Save (monitor);
				return tempSolution;
			}
		}
Example #34
0
		public override TargetFrameworkMoniker GetDefaultTargetFrameworkForFormat (FileFormat format)
		{
			switch (format.Id) {
			case "MSBuild08":
				return new TargetFrameworkMoniker ("Silverlight", "3.0");
			default:
				return new TargetFrameworkMoniker ("Silverlight", "4.0");
			}
		}
Example #35
0
		public void Export (WorkspaceItem item, FileFormat format)
		{
			ExportSolutionDialog dlg = new ExportSolutionDialog (item, format);
			
			try {
				if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
					using (IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetToolOutputProgressMonitor (true)) {
						Services.ProjectService.Export (monitor, item.FileName, dlg.TargetFolder, dlg.Format);
					}
				}
			} finally {
				dlg.Destroy ();
			}
		}
        public void RegisterFileFormat(IFileFormat format, string id, string name, bool canDefault)
        {
            FileFormat f = new FileFormat(format, id, name, canDefault);

            fileFormats.Add(f);
        }