/// <summary> /// Updates the output name text box based on the assembly name and /// output type. /// </summary> void RefreshOutputNameTextBox() { string assemblyName = AssemblyNameTextBox.Text; string extension = CompilableProject.GetExtension((OutputType)OutputTypeComboBox.SelectedIndex); Get <TextBox>("outputName").Text = String.Concat(assemblyName, extension); }
protected override void Load(MSBuildBasedProject project, string configuration, string platform) { base.Load(project, configuration, platform); // Ensure that the template is applied before we assign ComboBox.Text, this ensures // the TextBoxBase.TextChanged event fires immediately and doesn't cause us to // set the IsDirty flag later. applicationManifestComboBox.ApplyTemplate(); if (string.IsNullOrEmpty(this.ApplicationManifest.Value)) { if (this.NoWin32Manifest.Value) { applicationManifestComboBox.SelectedIndex = 1; } else { applicationManifestComboBox.SelectedIndex = 0; } } else { applicationManifestComboBox.Text = this.ApplicationManifest.Value; } this.projectInformation.OutputTypeName = AssemblyName.Value + CompilableProject.GetExtension(OutputType.Value); IsDirty = false; }
string GetOutputTypeFileExtension() { string outputTypeProperty = GetMSBuildProjectProperty("OutputType"); OutputType outputType = GetOutputType(outputTypeProperty); return(CompilableProject.GetExtension(outputType)); }
void TryOpenAppConfig(bool createIfNotExists) { if (appConfigFile != null) // already open { return; } if (ProjectService.OpenSolution == null) { return; } IProject p = SD.ProjectService.FindProjectContainingFile(this.PrimaryFileName); if (p == null) { return; } FileName appConfigFileName = CompilableProject.GetAppConfigFile(p, createIfNotExists); if (appConfigFileName != null) { appConfigFile = SD.FileService.GetOrCreateOpenedFile(appConfigFileName); this.Files.Add(appConfigFile); if (createIfNotExists) { appConfigFile.MakeDirty(); } appConfigFile.ForceInitializeView(this); } }
protected void InitTargetFramework() { Button convertProjectToMSBuild35Button = (Button)ControlDictionary["convertProjectToMSBuild35Button"]; ComboBox targetFrameworkComboBox = (ComboBox)ControlDictionary["targetFrameworkComboBox"]; if (convertProjectToMSBuild35Button != null) { //if (project.MinimumSolutionVersion == Solution.SolutionVersionVS2005) { // // VS05 project // targetFrameworkComboBox.Enabled = false; // convertProjectToMSBuild35Button.Click += OnConvertProjectToMSBuild35ButtonClick; // return; //} else { // // VS08 project // targetFrameworkComboBox.Enabled = true; // convertProjectToMSBuild35Button.Visible = false; //} } const string TargetFrameworkProperty = "TargetFrameworkVersion"; ConfigurationGuiBinding targetFrameworkBinding; targetFrameworkBinding = helper.BindStringEnum( "targetFrameworkComboBox", TargetFrameworkProperty, "v2.0", (from targetFramework in Internal.Templates.TargetFramework.TargetFrameworks where targetFramework.DisplayName != null select new StringPair(targetFramework.Name, targetFramework.DisplayName)).ToArray()); targetFrameworkBinding.CreateLocationButton("targetFrameworkLabel"); helper.Saved += delegate { CompilableProject cProject = (CompilableProject)project; cProject.AddOrRemoveExtensions(); }; }
public void SetUp() { project = new MockCSharpProject(); project.FileName = @"C:\Projects\MyTests\MyTests.csproj"; project.AssemblyName = "MyTests"; project.OutputType = OutputType.Library; helper = new UnitTestApplicationStartHelper(); }
public void SetUp() { project = new MockCSharpProject(); project.FileName = @"C:\Projects\MyTests\MyTests.csproj"; project.AssemblyName = "MyTests"; project.OutputType = OutputType.Library; project.SetProperty("OutputPath", null); }
public override void Run() { CompilableProject project = (CompilableProject)Owner; if (project.TargetFrameworkVersion == "v3.5") { project.AddDotnet35References(); } }
public void SetUp() { project = new MockCSharpProject(); project.FileName = @"C:\Projects\MyTests\MyTests.csproj"; project.AssemblyName = "MyTests"; project.OutputType = OutputType.Library; project.SetProperty("OutputPath", "."); // don't create bin/Debug project.SetProperty("TargetFrameworkVersion", "v4.0"); helper = new UnitTestApplicationStartHelper(); }
void ProjectCreated(object sender, ProjectEventArgs e) { if (!AddInOptions.AutomaticallyAddFiles) { return; } if (!CanBeVersionControlledFile(e.Project.Directory)) { return; } string projectDir = Path.GetFullPath(e.Project.Directory); try { using (SvnClientWrapper client = new SvnClientWrapper()) { SvnMessageView.HandleNotifications(client); Status status = client.SingleStatus(projectDir); if (status.TextStatus != StatusKind.Unversioned) { return; } client.Add(projectDir, Recurse.None); if (FileUtility.IsBaseDirectory(Path.Combine(projectDir, "bin"), e.Project.OutputAssemblyFullPath)) { client.AddToIgnoreList(projectDir, "bin"); } CompilableProject compilableProject = e.Project as CompilableProject; if (compilableProject != null) { if (FileUtility.IsBaseDirectory(Path.Combine(projectDir, "obj"), compilableProject.IntermediateOutputFullPath)) { client.AddToIgnoreList(projectDir, "obj"); } } foreach (ProjectItem item in e.Project.Items) { FileProjectItem fileItem = item as FileProjectItem; if (fileItem != null) { if (FileUtility.IsBaseDirectory(projectDir, fileItem.FileName)) { AddFileWithParentDirectoriesToSvn(client, fileItem.FileName); } } } AddFileWithParentDirectoriesToSvn(client, e.Project.FileName); } } catch (SvnClientException ex) { MessageService.ShowError(ex.Message); } catch (Exception ex) { MessageService.ShowException(ex, "Project add exception"); } }
XmlDocument LoadAppConfig() { AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.SelectedNode; FileName appConfigFileName = CompilableProject.GetAppConfigFile(node.Project, false); if (!String.IsNullOrEmpty(appConfigFileName)) { return(LoadAppConfig(appConfigFileName)); } return(null); }
protected override void ConvertAst(CompilationUnit compilationUnit, List <ISpecial> specials, FileProjectItem sourceItem) { PreprocessingDirective.VBToCSharp(specials); CompilableProject project = (CompilableProject)sourceItem.Project; RemoveWindowsFormsSpecificCode(compilationUnit, specials, project.OutputType == OutputType.WinExe); IProjectContent pc = ParserService.GetProjectContent(sourceItem.Project) ?? ParserService.CurrentProjectContent; VBNetToCSharpConvertVisitor visitor = new VBNetToCSharpConvertVisitorWithMyFormsSupport(pc, ParserService.GetParseInformation(sourceItem.FileName), sourceItem.Project.RootNamespace); compilationUnit.AcceptVisitor(visitor, null); }
public override void Run() { CompilableProject project = ProjectService.CurrentProject as CompilableProject; if (project == null) { return; } string assembly = project.OutputAssemblyFullPath; if (!File.Exists(assembly)) { MessageService.ShowMessage("${res:ProjectComponent.ContextMenu.GenerateDocumentation.ProjectNeedsToBeCompiled}"); return; } string xmlDocFile = project.DocumentationFileFullPath; if (xmlDocFile == null) { MessageService.ShowMessage("${res:ProjectComponent.ContextMenu.GenerateDocumentation.NeedToEditBuildOptions}"); return; } if (!File.Exists(xmlDocFile)) { MessageService.ShowMessage("${res:ProjectComponent.ContextMenu.GenerateDocumentation.ProjectNeedsToBeCompiled2}"); return; } string nDocProjectFile = Path.ChangeExtension(assembly, ".ndoc"); if (!File.Exists(nDocProjectFile)) { using (StreamWriter sw = File.CreateText(nDocProjectFile)) { sw.WriteLine("<project>"); sw.WriteLine(" <assemblies>"); sw.WriteLine(" <assembly location=\"" + assembly + "\" documentation=\"" + xmlDocFile + "\" />"); sw.WriteLine(" </assemblies>"); sw.WriteLine("</project>"); } } string nDocDir = Path.Combine(FileUtility.ApplicationRootPath, "bin/Tools/NDoc"); ProcessStartInfo psi = new ProcessStartInfo(Path.Combine(nDocDir, "NDocGui.exe"), '"' + nDocProjectFile + '"'); psi.WorkingDirectory = nDocDir; psi.UseShellExecute = false; Process.Start(psi); }
protected override void ConvertAst(CompilationUnit compilationUnit, List <ISpecial> specials, FileProjectItem sourceItem) { PreprocessingDirective.VBToCSharp(specials); CompilableProject project = (CompilableProject)sourceItem.Project; RemoveWindowsFormsSpecificCode(compilationUnit, specials, project.OutputType == OutputType.WinExe); IProjectContent pc = ParserService.GetProjectContent(sourceItem.Project) ?? ParserService.CurrentProjectContent; VBNetToCSharpConvertVisitor visitor = new VBNetToCSharpConvertVisitorWithMyFormsSupport(pc, ParserService.GetParseInformation(sourceItem.FileName), sourceItem.Project.RootNamespace); // set project options visitor.OptionInfer = (project.GetEvaluatedProperty("OptionInfer") ?? "Off") .Equals("On", StringComparison.OrdinalIgnoreCase); visitor.OptionStrict = (project.GetEvaluatedProperty("OptionStrict") ?? "Off") .Equals("On", StringComparison.OrdinalIgnoreCase); compilationUnit.AcceptVisitor(visitor, null); }
public override void Run() { CompilableProject project = ProjectService.CurrentProject as CompilableProject; if (project == null) { return; } // Explorer does not handle relative paths as a command line argument properly string outputFolder = project.OutputFullPath; if (!Directory.Exists(outputFolder)) { Directory.CreateDirectory(outputFolder); } OpenFolder.OpenFolderInExplorer(outputFolder); }
static Compiler.CompilerParameters GetParameters(CompilableProject project) { Compiler.CompilerParameters p = new Compiler.CompilerParameters(); var items = project.GetItemsOfType(ItemType.Reference) .OfType <ReferenceProjectItem>() .Select(item => item.FileName) .Concat( project.GetItemsOfType(ItemType.ProjectReference) .OfType <ProjectReferenceProjectItem>() .Select(item => item.ReferencedProject.OutputAssemblyFullPath) ); TargetFramework tf = project.CurrentTargetFramework; if (tf == null) { throw new InvalidOperationException(); } p.CompilerOptions = "/nostdlib /unsafe"; p.GenerateInMemory = true; p.ReferencedAssemblies.AddRange(items.ToArray()); string mscorlib = GetMscorlibPath(tf); if (mscorlib != null) { p.ReferencedAssemblies.Add(mscorlib); } if (IsGreaterThan(Util.TargetDotNetFrameworkVersion.Version35, VersionForString(tf.Name)) && !p.ReferencedAssemblies.OfType <string>().Any(s => s.Contains("System.Core.dll"))) { p.ReferencedAssemblies.Add("System.Core.dll"); } return(p); }
void RefreshOutputNameTextBox(object sender, EventArgs e) { Get <TextBox>("outputName").Text = Get <TextBox>("assemblyName").Text + CompilableProject.GetExtension((OutputType)Get <ComboBox>("outputType").SelectedIndex); }
internal static string BuildMyNamespaceCode(CompilableProject vbProject) { string ns; if (string.IsNullOrEmpty(vbProject.RootNamespace)) { ns = "My"; } else { ns = vbProject.RootNamespace + ".My"; } string projectType; if (vbProject.OutputType == OutputType.WinExe) { projectType = "WindowsApplication"; } else if (vbProject.OutputType == OutputType.Exe) { projectType = "ConsoleApplication"; } else { projectType = "Library"; } StringBuilder output = new StringBuilder(); bool outputActive = true; using (StreamReader r = new StreamReader(OpenResource())) { string line; while ((line = r.ReadLine()) != null) { string trimmedLine = line.Trim(); if (trimmedLine == "#endif") { outputActive = true; continue; } if (!outputActive) { continue; } if (trimmedLine == "/*LIST OF FORMS*/") { IClass myFormsClass = FindMyFormsClass(ParserService.GetProjectContent(vbProject), ns); if (myFormsClass != null) { string indentation = line.Substring(0, line.Length - trimmedLine.Length); foreach (IProperty p in myFormsClass.Properties) { string typeName = "global::" + p.ReturnType.FullyQualifiedName; output.AppendLine(indentation + typeName + " " + p.Name + "_instance;"); output.AppendLine(indentation + "bool " + p.Name + "_isCreating;"); output.AppendLine(indentation + "public " + typeName + " " + p.Name + " {"); output.AppendLine(indentation + "\t[DebuggerStepThrough] get { return GetForm(ref " + p.Name + "_instance, ref " + p.Name + "_isCreating); }"); output.AppendLine(indentation + "\t[DebuggerStepThrough] set { SetForm(ref " + p.Name + "_instance, value); }"); output.AppendLine(indentation + "}"); output.AppendLine(indentation); } } } else if (trimmedLine.StartsWith("#if ")) { outputActive = trimmedLine.Substring(4) == projectType; } else { output.AppendLine(StringParser.Parse(line.Replace("MyNamespace", ns))); } } } return(output.ToString()); }
void RefreshOutputNameTextBox(object sender, TextChangedEventArgs e) { if (this.outputTypeComboBox.SelectedValue != null) { var enmType = (OutputType)Enum.Parse(typeof(OutputType), this.outputTypeComboBox.SelectedValue.ToString()); this.projectInformation.OutputTypeName = this.assemblyNameTextBox.Text + CompilableProject.GetExtension(enmType); } }
public override void Run() { CompilableProject project = ProjectService.CurrentProject as CompilableProject; if (project == null) { return; } string sandcastleHelpFileBuilderPath = FindSHFB(); if (sandcastleHelpFileBuilderPath == null || !File.Exists(sandcastleHelpFileBuilderPath)) { using (ToolNotFoundDialog dlg = new ToolNotFoundDialog( StringParser.Parse("${res:ProjectComponent.ContextMenu.GenerateDocumentation.SHFBNotFound}"), "http://www.codeplex.com/SHFB/", null)) { dlg.ShowDialog(SD.WinForms.MainWin32Window); } return; } string assembly = project.OutputAssemblyFullPath; string xmlDocFile = project.DocumentationFileFullPath; if (xmlDocFile == null) { MessageService.ShowMessage("${res:ProjectComponent.ContextMenu.GenerateDocumentation.NeedToEditBuildOptions}"); return; } if (!File.Exists(assembly)) { MessageService.ShowMessage("${res:ProjectComponent.ContextMenu.GenerateDocumentation.ProjectNeedsToBeCompiled}"); return; } if (!File.Exists(xmlDocFile)) { MessageService.ShowMessage("${res:ProjectComponent.ContextMenu.GenerateDocumentation.ProjectNeedsToBeCompiled2}"); return; } string sandcastleHelpFileBuilderProjectFile = Path.ChangeExtension(project.FileName, ".shfbproj"); if (!File.Exists(sandcastleHelpFileBuilderProjectFile)) { using (XmlTextWriter w = new XmlTextWriter(sandcastleHelpFileBuilderProjectFile, Encoding.UTF8)) { w.Formatting = Formatting.Indented; const string ns = "http://schemas.microsoft.com/developer/msbuild/2003"; w.WriteStartElement("Project", ns); w.WriteAttributeString("DefaultTargets", "Build"); w.WriteAttributeString("ToolsVersion", "3.5"); w.WriteStartElement("PropertyGroup", ns); w.WriteComment("The configuration and platform will be used to determine which\n" + "assemblies to include from solution and project documentation\n" + "sources"); w.WriteStartElement("Configuration", ns); w.WriteAttributeString("Condition", " '$(Configuration)' == '' "); w.WriteValue("Debug"); w.WriteEndElement(); // </Configuration> w.WriteStartElement("Platform", ns); w.WriteAttributeString("Condition", " '$(Platform)' == '' "); w.WriteValue("AnyCPU"); w.WriteEndElement(); // </AnyCPU> w.WriteElementString("SchemaVersion", ns, "2.0"); w.WriteElementString("ProjectGuid", ns, Guid.NewGuid().ToString("B")); w.WriteElementString("SHFBSchemaVersion", ns, "1.8.0.3"); w.WriteElementString("AssemblyName", ns, "Documentation"); w.WriteElementString("RootNamespace", ns, "Documentation"); w.WriteElementString("Name", ns, "Documentation"); w.WriteElementString("OutputPath", ns, @".\Help\"); w.WriteElementString("HtmlHelpName", ns, "Documentation"); w.WriteStartElement("DocumentationSources", ns); w.WriteStartElement("DocumentationSource", ""); w.WriteAttributeString("sourceFile", FileUtility.GetRelativePath(Path.GetDirectoryName(sandcastleHelpFileBuilderProjectFile), project.FileName)); w.WriteEndElement(); // </DocumentationSource> w.WriteEndElement(); // </DocumentationSources> w.WriteEndElement(); // </PropertyGrup> w.WriteComment("There are no properties for these groups. AnyCPU needs to appear in\n" + "order for Visual Studio to perform the build. The others are optional\n" + "common platform types that may appear."); string[] confPlatList = { "Debug|AnyCPU", "Release|AnyCPU", "Debug|x86", "Release|x86", "Debug|x64", "Release|x64", "Debug|Win32", "Release|Win32" }; foreach (string confPlat in confPlatList) { w.WriteStartElement("PropertyGroup", ns); w.WriteAttributeString("Condition", " '$(Configuration)|$(Platform)' == '" + confPlat + "' "); w.WriteEndElement(); // </PropertyGrup> } w.WriteComment("Import the SHFB build targets"); w.WriteStartElement("Import", ns); w.WriteAttributeString("Project", @"$(SHFBROOT)\SandcastleHelpFileBuilder.targets"); w.WriteEndElement(); // </Import> w.WriteEndElement(); // </Project> } } ProcessStartInfo psi = new ProcessStartInfo(sandcastleHelpFileBuilderPath, '"' + sandcastleHelpFileBuilderProjectFile + '"'); psi.WorkingDirectory = Path.GetDirectoryName(sandcastleHelpFileBuilderPath); psi.UseShellExecute = false; Process.Start(psi); }
void RefreshOutputNameTextBox(object sender, EventArgs e) { if (this.outputTypeComboBox.SelectedValue != null) { var outputType = (OutputType)this.outputTypeComboBox.SelectedValue; this.projectInformation.OutputTypeName = this.assemblyNameTextBox.Text + CompilableProject.GetExtension(outputType); } }