Exemple #1
0
        public override SolutionItemConfiguration CreateConfiguration(string name)
        {
            DotNetProjectConfiguration conf = new DotNetProjectConfiguration(name);
            string dir;

            if (conf.Platform.Length == 0)
            {
                dir = Path.Combine("bin", conf.Name);
            }
            else
            {
                dir = Path.Combine(Path.Combine("bin", conf.Platform), conf.Name);
            }

            conf.OutputDirectory = String.IsNullOrEmpty(BaseDirectory) ? dir : Path.Combine(BaseDirectory, dir);
            conf.OutputAssembly  = Name;
            if (LanguageBinding != null)
            {
                XmlElement xconf = null;
                if (!string.IsNullOrEmpty(conf.Platform))
                {
                    XmlDocument doc = new XmlDocument();
                    xconf = doc.CreateElement("Options");
                    xconf.SetAttribute("Platform", conf.Platform);
                }
                conf.CompilationParameters = LanguageBinding.CreateCompilationParameters(xconf);
            }
            return(conf);
        }
Exemple #2
0
        public void TestConfigurationMergingKeepOldConfig()
        {
            string        projectFile = Util.GetSampleProject("test-configuration-merging", "TestConfigurationMerging4.csproj");
            DotNetProject p           = Services.ProjectService.ReadSolutionItem(Util.GetMonitor(), projectFile) as DotNetProject;

            Assert.IsNotNull(p);

            DotNetProjectConfiguration conf = p.Configurations ["Debug|x86"] as DotNetProjectConfiguration;

            Assert.IsNotNull(conf);
            Assert.IsTrue(conf.DebugMode);
            CSharpCompilerParameters cparams = (CSharpCompilerParameters)conf.CompilationParameters;

            Assert.IsTrue(cparams.UnsafeCode);

            conf = p.Configurations ["Release|x86"] as DotNetProjectConfiguration;
            Assert.IsNotNull(conf);
            Assert.IsFalse(conf.DebugMode);
            conf.DebugMode = true;
            cparams        = (CSharpCompilerParameters)conf.CompilationParameters;
            Assert.IsFalse(cparams.UnsafeCode);
            cparams.UnsafeCode = true;

            p.Save(Util.GetMonitor());

            Assert.AreEqual(Util.GetXmlFileInfoset(p.FileName + ".saved"), Util.GetXmlFileInfoset(p.FileName));
        }
Exemple #3
0
        protected override void DoExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
        {
            DotNetProjectConfiguration dotNetProjectConfig = GetConfiguration(configuration) as DotNetProjectConfiguration;

            monitor.Log.WriteLine(GettextCatalog.GetString("Running {0} ...", dotNetProjectConfig.CompiledOutputName));

            IConsole console = dotNetProjectConfig.ExternalConsole
                                ? context.ExternalConsoleFactory.CreateConsole(!dotNetProjectConfig.PauseConsoleOutput)
                                : context.ConsoleFactory.CreateConsole(!dotNetProjectConfig.PauseConsoleOutput);

            AggregatedOperationMonitor aggregatedOperationMonitor = new AggregatedOperationMonitor(monitor);

            try {
                try {
                    ExecutionCommand executionCommand = CreateExecutionCommand(configuration, dotNetProjectConfig);

                    if (!context.ExecutionHandler.CanExecute(executionCommand))
                    {
                        monitor.ReportError(GettextCatalog.GetString("Can not execute \"{0}\". The selected execution mode is not supported for .NET projects.", dotNetProjectConfig.CompiledOutputName), null);
                        return;
                    }

                    IProcessAsyncOperation asyncOp = context.ExecutionHandler.Execute(executionCommand, console);
                    aggregatedOperationMonitor.AddOperation(asyncOp);
                    asyncOp.WaitForCompleted();

                    monitor.Log.WriteLine(GettextCatalog.GetString("The application exited with code: {0}", asyncOp.ExitCode));
                } finally {
                    console.Dispose();
                    aggregatedOperationMonitor.Dispose();
                }
            } catch (Exception ex) {
                monitor.ReportError(GettextCatalog.GetString("Cannot execute \"{0}\"", dotNetProjectConfig.CompiledOutputName), ex);
            }
        }
Exemple #4
0
        public async Task TestConfigurationMergingKeepOldConfig()
        {
            string        projectFile = Util.GetSampleProject("test-configuration-merging", "TestConfigurationMerging4.csproj");
            DotNetProject p           = await Services.ProjectService.ReadSolutionItem(Util.GetMonitor(), projectFile) as DotNetProject;

            Assert.IsNotNull(p);

            DotNetProjectConfiguration conf = p.Configurations ["Debug|x86"] as DotNetProjectConfiguration;

            Assert.IsNotNull(conf);
            Assert.IsTrue(conf.DebugSymbols);
            dynamic cparams = conf.CompilationParameters;

            Assert.IsTrue(cparams.UnsafeCode);

            conf = p.Configurations ["Release|x86"] as DotNetProjectConfiguration;
            Assert.IsNotNull(conf);
            Assert.IsFalse(conf.DebugSymbols);
            conf.DebugSymbols = true;
            cparams           = conf.CompilationParameters;
            Assert.IsFalse(cparams.UnsafeCode);
            cparams.UnsafeCode = true;

            await p.SaveAsync(Util.GetMonitor());

            Assert.AreEqual(Util.ToSystemEndings(File.ReadAllText(p.FileName + ".saved")), File.ReadAllText(p.FileName));

            p.Dispose();
        }
Exemple #5
0
        public static void InitializeProject(string dir, DotNetProject project, string name)
        {
            project.DefaultNamespace = name;

            DotNetProjectConfiguration pcDebug = project.AddNewConfiguration("Debug") as DotNetProjectConfiguration;

            pcDebug.DebugType       = "full";
            pcDebug.OutputDirectory = Path.Combine(dir, "bin/Debug");
            pcDebug.OutputAssembly  = name;
            pcDebug.DebugSymbols    = true;
            dynamic csparamsDebug = pcDebug.CompilationParameters;

            csparamsDebug.DefineSymbols = "DEBUG;TRACE";
            csparamsDebug.Optimize      = false;

            DotNetProjectConfiguration pcRelease = project.AddNewConfiguration("Release") as DotNetProjectConfiguration;

            pcRelease.DebugType       = "none";
            pcRelease.OutputDirectory = Path.Combine(dir, "bin/Release");
            pcRelease.OutputAssembly  = name;
            dynamic csparamsRelease = pcRelease.CompilationParameters;

            csparamsRelease.DefineSymbols = "TRACE";
            csparamsRelease.Optimize      = true;

            string pfile = Path.Combine(dir, name);

            project.FileName = pfile;
        }
Exemple #6
0
        public void CustomCommands()
        {
            DotNetProject p = Services.ProjectService.CreateDotNetProject("C#");

            p.Name = "SomeProject";
            DotNetProjectConfiguration c = (DotNetProjectConfiguration)p.CreateConfiguration("First");

            CustomCommand cmd = new CustomCommand();

            cmd.Command = "aa bb cc";
            Assert.AreEqual("aa", cmd.GetCommandFile(p, c.Selector));
            Assert.AreEqual("bb cc", cmd.GetCommandArgs(p, c.Selector));

            cmd.Command = "\"aa bb\" cc dd";
            Assert.AreEqual("aa bb", cmd.GetCommandFile(p, c.Selector));
            Assert.AreEqual("cc dd", cmd.GetCommandArgs(p, c.Selector));

            cmd.Command = "\"aa ${ProjectName}\" cc ${ProjectName}";
            Assert.AreEqual("aa SomeProject", cmd.GetCommandFile(p, c.Selector));
            Assert.AreEqual("cc SomeProject", cmd.GetCommandArgs(p, c.Selector));

            cmd.WorkingDir = NormalizePath("/some/${ProjectName}/place");
            Assert.AreEqual(Path.GetFullPath(NormalizePath("/some/SomeProject/place")), (string)cmd.GetCommandWorkingDir(p, c.Selector));
            p.Dispose();
        }
        public void NewConfigurationsHaveAnAssemblyName()
        {
            DotNetProject p = new DotNetAssemblyProject("C#");

            p.Name = "HiThere";
            DotNetProjectConfiguration c = (DotNetProjectConfiguration)p.CreateConfiguration("First");

            Assert.AreEqual("HiThere", c.OutputAssembly);
        }
Exemple #8
0
        public async Task TestConfigurationMerging()
        {
            string   solFile = Util.GetSampleProject("test-configuration-merging", "TestConfigurationMerging.sln");
            Solution sol     = await Services.ProjectService.ReadWorkspaceItem(Util.GetMonitor(), solFile) as Solution;

            Assert.IsNotNull(sol);
            Assert.AreEqual(1, sol.Items.Count);

            DotNetProject p = sol.Items[0] as DotNetProject;

            Assert.IsNotNull(p);

            // Debug config

            DotNetProjectConfiguration conf = p.Configurations["Debug"] as DotNetProjectConfiguration;

            Assert.IsNotNull(conf);
            Assert.AreEqual("Debug", conf.Name);
            Assert.AreEqual(string.Empty, conf.Platform);

            dynamic pars = conf.CompilationParameters;

            Assert.IsNotNull(pars);
            Assert.AreEqual(2, pars.WarningLevel);

            pars.WarningLevel = 4;

            // Release config

            conf = p.Configurations["Release"] as DotNetProjectConfiguration;
            Assert.IsNotNull(conf);
            Assert.AreEqual("Release", conf.Name);
            Assert.AreEqual(string.Empty, conf.Platform);

            pars = conf.CompilationParameters;
            Assert.IsNotNull(pars);
            Assert.AreEqual("ReleaseMod", Path.GetFileName(conf.OutputDirectory));
            Assert.AreEqual(3, pars.WarningLevel);

            pars.WarningLevel = 1;
            Assert.AreEqual(1, pars.WarningLevel);
            conf.DebugType    = "full";
            conf.DebugSymbols = true;

            await sol.SaveAsync(Util.GetMonitor());

            Assert.AreEqual(1, pars.WarningLevel);

            string savedFile = Path.Combine(p.BaseDirectory, "TestConfigurationMergingSaved.csproj");

            Assert.AreEqual(File.ReadAllText(savedFile), File.ReadAllText(p.FileName));

            sol.Dispose();
        }
Exemple #9
0
        protected internal override bool OnGetCanExecute(ExecutionContext context, ConfigurationSelector configuration)
        {
            DotNetProjectConfiguration config = (DotNetProjectConfiguration)GetConfiguration(configuration);

            if (config == null)
            {
                return(false);
            }
            ExecutionCommand cmd = CreateExecutionCommand(configuration, config);

            return((compileTarget == CompileTarget.Exe || compileTarget == CompileTarget.WinExe) && context.ExecutionHandler.CanExecute(cmd));
        }
Exemple #10
0
        public override FilePath GetOutputFileName(ConfigurationSelector configuration)
        {
            DotNetProjectConfiguration conf = (DotNetProjectConfiguration)GetConfiguration(configuration);

            if (conf != null)
            {
                return(conf.CompiledOutputName);
            }
            else
            {
                return(null);
            }
        }
Exemple #11
0
        public void TestConfigurationMerging()
        {
            string   solFile = Util.GetSampleProject("test-configuration-merging", "TestConfigurationMerging.sln");
            Solution sol     = Services.ProjectService.ReadWorkspaceItem(Util.GetMonitor(), solFile) as Solution;

            Assert.IsNotNull(sol);
            Assert.AreEqual(1, sol.Items.Count);

            DotNetProject p = sol.Items [0] as DotNetProject;

            Assert.IsNotNull(p);

            // Debug config

            DotNetProjectConfiguration conf = p.Configurations ["Debug"] as DotNetProjectConfiguration;

            Assert.IsNotNull(conf);
            Assert.AreEqual("Debug", conf.Name);
            Assert.AreEqual(string.Empty, conf.Platform);

            CSharpCompilerParameters pars = conf.CompilationParameters as CSharpCompilerParameters;

            Assert.IsNotNull(pars);
            Assert.AreEqual(2, pars.WarningLevel);

            pars.WarningLevel = 4;

            // Release config

            conf = p.Configurations ["Release"] as DotNetProjectConfiguration;
            Assert.IsNotNull(conf);
            Assert.AreEqual("Release", conf.Name);
            Assert.AreEqual(string.Empty, conf.Platform);

            pars = conf.CompilationParameters as CSharpCompilerParameters;
            Assert.IsNotNull(pars);
            Assert.AreEqual("ReleaseMod", Path.GetFileName(conf.OutputDirectory));
            Assert.AreEqual(3, pars.WarningLevel);

            pars.WarningLevel = 1;
            Assert.AreEqual(1, pars.WarningLevel);
            conf.DebugMode = true;

            sol.Save(Util.GetMonitor());
            Assert.AreEqual(1, pars.WarningLevel);

            string savedFile = Path.Combine(p.BaseDirectory, "TestConfigurationMergingSaved.csproj");

            Assert.AreEqual(Util.GetXmlFileInfoset(savedFile), Util.GetXmlFileInfoset(p.FileName));
        }
Exemple #12
0
        public override void CopyFrom(ItemConfiguration configuration)
        {
            base.CopyFrom(configuration);
            DotNetProjectConfiguration conf = (DotNetProjectConfiguration)configuration;

            assembly   = conf.assembly;
            sourcePath = conf.sourcePath;
            if (ParentItem == null)
            {
                SetParentItem(conf.ParentItem);
            }
            CompilationParameters = conf.compilationParameters != null?conf.compilationParameters.Clone() : null;

            signAssembly    = conf.signAssembly;
            assemblyKeyFile = conf.assemblyKeyFile;
        }
        protected override void OnCopyFrom(ItemConfiguration configuration, bool isRename)
        {
            base.OnCopyFrom(configuration, isRename);
            DotNetProjectConfiguration conf = (DotNetProjectConfiguration)configuration;

            assembly   = conf.assembly;
            sourcePath = conf.sourcePath;
            if (ParentItem == null)
            {
                SetParentItem(conf.ParentItem);
            }
            CompilationParameters = conf.compilationParameters != null?conf.compilationParameters.Clone() : null;

            signAssembly    = conf.signAssembly;
            delaySign       = conf.delaySign;
            assemblyKeyFile = conf.assemblyKeyFile;
        }
Exemple #14
0
        public async Task TestConfigurationMergingChangeMergeToParent5()
        {
            // Test for VSTS bug 518933 - Serialization issue with ItemProperty and MergeToProject

            string        projectFile = Util.GetSampleProject("test-configuration-merging", "TestConfigurationMerging11.csproj");
            DotNetProject p           = await Services.ProjectService.ReadSolutionItem(Util.GetMonitor(), projectFile) as DotNetProject;

            Assert.IsNotNull(p);

            DotNetProjectConfiguration debugConf   = p.Configurations ["Debug|x86"] as DotNetProjectConfiguration;
            DotNetProjectConfiguration releaseConf = p.Configurations ["Release|x86"] as DotNetProjectConfiguration;

            Assert.IsNotNull(debugConf);

            debugConf.Properties.SetValue("AndroidUseSharedRuntime", false, defaultValue: true, mergeToMainGroup: true);
            releaseConf.Properties.SetValue("AndroidUseSharedRuntime", false, defaultValue: true, mergeToMainGroup: true);

            // Release config already has SignAssembly=true, so the property should be merged to main group

            await p.SaveAsync(Util.GetMonitor());

            Assert.AreEqual(Util.ToSystemEndings(File.ReadAllText(p.FileName + ".saved")), File.ReadAllText(p.FileName));

            debugConf.Properties.SetValue("AndroidUseSharedRuntime", true, defaultValue: true, mergeToMainGroup: true);
            releaseConf.Properties.SetValue("AndroidUseSharedRuntime", false, defaultValue: true, mergeToMainGroup: true);

            // Release config still has SignAssembly=true, so the property should be removed from the main group and
            // assigned to true in Release configuration.

            await p.SaveAsync(Util.GetMonitor());

            Assert.AreEqual(Util.ToSystemEndings(File.ReadAllText(p.FileName + ".saved2")), File.ReadAllText(p.FileName));

            debugConf.Properties.SetValue("AndroidUseSharedRuntime", false, defaultValue: true, mergeToMainGroup: true);
            releaseConf.Properties.SetValue("AndroidUseSharedRuntime", false, defaultValue: true, mergeToMainGroup: true);

            await p.SaveAsync(Util.GetMonitor());

            Assert.AreEqual(Util.ToSystemEndings(File.ReadAllText(p.FileName + ".saved")), File.ReadAllText(p.FileName));

            p.Dispose();
        }
Exemple #15
0
        public void TestConfigurationMergingChangeNoMergeToParent()
        {
            string        projectFile = Util.GetSampleProject("test-configuration-merging", "TestConfigurationMerging5.csproj");
            DotNetProject p           = Services.ProjectService.ReadSolutionItem(Util.GetMonitor(), projectFile) as DotNetProject;

            Assert.IsNotNull(p);

            DotNetProjectConfiguration conf = p.Configurations ["Debug|x86"] as DotNetProjectConfiguration;

            Assert.IsNotNull(conf);
            Assert.IsTrue(conf.SignAssembly);

            conf = p.Configurations ["Release|x86"] as DotNetProjectConfiguration;
            Assert.IsNotNull(conf);
            Assert.IsTrue(conf.SignAssembly);
            conf.SignAssembly = false;

            p.Save(Util.GetMonitor());

            Assert.AreEqual(Util.GetXmlFileInfoset(p.FileName + ".saved"), Util.GetXmlFileInfoset(p.FileName));
        }
Exemple #16
0
        public async Task TestConfigurationMergingDefaultValues()
        {
            string        projectFile = Util.GetSampleProject("test-configuration-merging", "TestConfigurationMerging3.csproj");
            DotNetProject p           = await Services.ProjectService.ReadSolutionItem(Util.GetMonitor(), projectFile) as DotNetProject;

            Assert.IsNotNull(p);

            DotNetProjectConfiguration conf = p.Configurations["Release|x86"] as DotNetProjectConfiguration;

            Assert.IsNotNull(conf);
            dynamic cparams = conf.CompilationParameters;

            Assert.AreEqual(Microsoft.CodeAnalysis.CSharp.LanguageVersion.Default, cparams.LangVersion);
            cparams.LangVersion = Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp5;
            Assert.IsTrue(cparams.UnsafeCode);
            cparams.UnsafeCode = false;

            await p.SaveAsync(Util.GetMonitor());

            Assert.AreEqual(Util.ToSystemEndings(File.ReadAllText(p.FileName + ".saved")), File.ReadAllText(p.FileName));

            p.Dispose();
        }
Exemple #17
0
        public async Task TestConfigurationMergingChangeNoMergeToParent()
        {
            string        projectFile = Util.GetSampleProject("test-configuration-merging", "TestConfigurationMerging5.csproj");
            DotNetProject p           = await Services.ProjectService.ReadSolutionItem(Util.GetMonitor(), projectFile) as DotNetProject;

            Assert.IsNotNull(p);

            DotNetProjectConfiguration conf = p.Configurations["Debug|x86"] as DotNetProjectConfiguration;

            Assert.IsNotNull(conf);
            Assert.IsTrue(conf.SignAssembly);

            conf = p.Configurations["Release|x86"] as DotNetProjectConfiguration;
            Assert.IsNotNull(conf);
            Assert.IsTrue(conf.SignAssembly);
            conf.SignAssembly = false;

            await p.SaveAsync(Util.GetMonitor());

            Assert.AreEqual(Util.ToSystemEndings(File.ReadAllText(p.FileName + ".saved")), File.ReadAllText(p.FileName));

            p.Dispose();
        }
Exemple #18
0
        protected override bool CheckNeedsBuild(ConfigurationSelector configuration)
        {
            if (base.CheckNeedsBuild(configuration))
            {
                return(true);
            }

            DotNetProjectConfiguration configObj = (DotNetProjectConfiguration)GetConfiguration(configuration);

            if (GeneratesDebugInfoFile && configObj != null && configObj.DebugMode)
            {
                string file = GetOutputFileName(configuration);
                if (file != null)
                {
                    file = TargetRuntime.GetAssemblyDebugInfoFile(file);
                    FileInfo finfo = new FileInfo(file);
                    if (!finfo.Exists)
                    {
                        return(true);
                    }
                    else if (finfo.LastWriteTime < GetLastBuildTime(configuration))
                    {
                        return(true);
                    }
                }
            }

            foreach (ProjectFile file in Files)
            {
                if (file.BuildAction == BuildAction.EmbeddedResource && String.Compare(Path.GetExtension(file.FilePath), ".resx", true) == 0 && MD1DotNetProjectHandler.IsResgenRequired(file.FilePath))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #19
0
 public virtual Microsoft.CodeAnalysis.ParseOptions CreateParseOptions(DotNetProjectConfiguration configuration)
 {
     return(null);
 }
Exemple #20
0
        protected virtual ExecutionCommand CreateExecutionCommand(ConfigurationSelector configSel, DotNetProjectConfiguration configuration)
        {
            DotNetExecutionCommand cmd = new DotNetExecutionCommand(configuration.CompiledOutputName);

            cmd.Arguments            = configuration.CommandLineParameters;
            cmd.WorkingDirectory     = Path.GetDirectoryName(configuration.CompiledOutputName);
            cmd.EnvironmentVariables = new Dictionary <string, string> (configuration.EnvironmentVariables);
            cmd.TargetRuntime        = TargetRuntime;
            cmd.UserAssemblyPaths    = GetUserAssemblyPaths(configSel);
            return(cmd);
        }
Exemple #21
0
        public DotNetProject(string languageName, ProjectCreateInformation projectCreateInfo, XmlElement projectOptions) : this(languageName)
        {
            if ((projectOptions != null) && (projectOptions.Attributes["Target"] != null))
            {
                CompileTarget = (CompileTarget)Enum.Parse(typeof(CompileTarget), projectOptions.Attributes["Target"].Value);
            }
            else if (IsLibraryBasedProjectType)
            {
                CompileTarget = CompileTarget.Library;
            }

            if (this.LanguageBinding != null)
            {
                LanguageParameters = languageBinding.CreateProjectParameters(projectOptions);

                bool externalConsole = false;

                string platform = null;
                if (projectOptions != null)
                {
                    projectOptions.SetAttribute("DefineDebug", "True");
                    if (!projectOptions.HasAttribute("Platform"))
                    {
                        // Clone the element since we are going to change it
                        platform       = GetDefaultTargetPlatform(projectCreateInfo);
                        projectOptions = (XmlElement)projectOptions.CloneNode(true);
                        projectOptions.SetAttribute("Platform", platform);
                    }
                    else
                    {
                        platform = projectOptions.GetAttribute("Platform");
                    }
                    if (projectOptions.GetAttribute("ExternalConsole") == "True")
                    {
                        externalConsole = true;
                    }
                }
                string platformSuffix = string.IsNullOrEmpty(platform) ? string.Empty : "|" + platform;
                DotNetProjectConfiguration configDebug = CreateConfiguration("Debug" + platformSuffix) as DotNetProjectConfiguration;
                configDebug.CompilationParameters = languageBinding.CreateCompilationParameters(projectOptions);
                configDebug.DebugMode             = true;
                configDebug.ExternalConsole       = externalConsole;
                configDebug.PauseConsoleOutput    = externalConsole;
                Configurations.Add(configDebug);

                DotNetProjectConfiguration configRelease = CreateConfiguration("Release" + platformSuffix) as DotNetProjectConfiguration;
                if (projectOptions != null)
                {
                    projectOptions.SetAttribute("DefineDebug", "False");
                }
                configRelease.CompilationParameters = languageBinding.CreateCompilationParameters(projectOptions);
                configRelease.DebugMode             = false;
                configRelease.ExternalConsole       = externalConsole;
                configRelease.PauseConsoleOutput    = externalConsole;
                Configurations.Add(configRelease);
            }

            if ((projectOptions != null) && (projectOptions.Attributes["TargetFrameworkVersion"] != null))
            {
                targetFrameworkVersion = projectOptions.Attributes["TargetFrameworkVersion"].Value;
            }

            string binPath;
            if (projectCreateInfo != null)
            {
                Name             = projectCreateInfo.ProjectName;
                binPath          = projectCreateInfo.BinPath;
                defaultNamespace = SanitisePotentialNamespace(projectCreateInfo.ProjectName);
            }
            else
            {
                binPath = ".";
            }

            foreach (DotNetProjectConfiguration dotNetProjectConfig in Configurations)
            {
                dotNetProjectConfig.OutputDirectory = Path.Combine(binPath, dotNetProjectConfig.Name);

                if ((projectOptions != null) && (projectOptions.Attributes["PauseConsoleOutput"] != null))
                {
                    dotNetProjectConfig.PauseConsoleOutput = Boolean.Parse(projectOptions.Attributes["PauseConsoleOutput"].Value);
                }

                if (projectCreateInfo != null)
                {
                    dotNetProjectConfig.OutputAssembly = projectCreateInfo.ProjectName;
                }
            }
        }
Exemple #22
0
        void PopulateSupportFileList(FileCopySet list, ConfigurationSelector configuration, int referenceDistance)
        {
            if (referenceDistance < 2)
            {
                base.PopulateSupportFileList(list, configuration);
            }

            //rename the app.config file
            FileCopySet.Item appConfig = list.Remove("app.config");
            if (appConfig == null)
            {
                appConfig = list.Remove("App.config");
            }
            if (appConfig != null)
            {
                string output = Path.GetFileName(GetOutputFileName(configuration));
                list.Add(appConfig.Src, appConfig.CopyOnlyIfNewer, output + ".config");
            }

            //collect all the "local copy" references and their attendant files
            foreach (ProjectReference projectReference in References)
            {
                if (!projectReference.LocalCopy || ParentSolution == null)
                {
                    continue;
                }

                if (projectReference.ReferenceType == ReferenceType.Project)
                {
                    DotNetProject p = ParentSolution.FindProjectByName(projectReference.Reference) as DotNetProject;

                    if (p == null)
                    {
                        LoggingService.LogWarning("Project '{0}' referenced from '{1}' could not be found", projectReference.Reference, this.Name);
                        continue;
                    }

                    string refOutput = p.GetOutputFileName(configuration);
                    if (string.IsNullOrEmpty(refOutput))
                    {
                        LoggingService.LogWarning("Project '{0}' referenced from '{1}' has an empty output filename", p.Name, this.Name);
                        continue;
                    }

                    list.Add(refOutput);

                    //VS COMPAT: recursively copy references's "local copy" files
                    //but only copy the "copy to output" files from the immediate references
                    p.PopulateSupportFileList(list, configuration, referenceDistance + 1);

                    DotNetProjectConfiguration refConfig = p.GetConfiguration(configuration) as DotNetProjectConfiguration;

                    if (refConfig != null && refConfig.DebugMode)
                    {
                        string mdbFile = TargetRuntime.GetAssemblyDebugInfoFile(refOutput);
                        if (File.Exists(mdbFile))
                        {
                            list.Add(mdbFile);
                        }
                    }
                }
                else if (projectReference.ReferenceType == ReferenceType.Assembly)
                {
                    // VS COMPAT: Copy the assembly, but also all other assemblies referenced by it
                    // that are located in the same folder
                    foreach (string file in GetAssemblyRefsRec(projectReference.Reference, new HashSet <string> ()))
                    {
                        list.Add(file);
                        if (File.Exists(file + ".config"))
                        {
                            list.Add(file + ".config");
                        }
                        string mdbFile = TargetRuntime.GetAssemblyDebugInfoFile(file);
                        if (File.Exists(mdbFile))
                        {
                            list.Add(mdbFile);
                        }
                    }
                }
                else if (projectReference.ReferenceType == ReferenceType.Custom)
                {
                    foreach (string refFile in projectReference.GetReferencedFileNames(configuration))
                    {
                        list.Add(refFile);
                    }
                }
            }
        }
Exemple #23
0
 internal protected virtual ExecutionCommand OnCreateExecutionCommand(ConfigurationSelector configSel, DotNetProjectConfiguration configuration)
 {
     return(next.OnCreateExecutionCommand(configSel, configuration));
 }