Exemple #1
0
        /// <summary>
        /// Add the new 'BinInclude.txt' file to the Web project
        /// </summary>
        /// <param name="title">The title of this step</param>
        private void AddBinIncludeFile(string title)
        {
            LogEventStart(title);

            var binInclude = Path.Combine(_settings.DestinationWebFolder, Constants.Common.BinIncludeFile);

            if (!File.Exists(binInclude))
            {
                // File doesn't yet exist. Let's create an empty one and add it to the Web project
                FileUtilities.CreateEmptyFile(binInclude);

                // Add this file to the project definition (if it was actually created successfully)
                if (File.Exists(binInclude))
                {
                    var solution = _settings.Solution;
                    var projects = solution.Projects;
                    foreach (Project project in projects)
                    {
                        var fullName = project.FullName;
                        if (IsWebProject(fullName))
                        {
                            project.ProjectItems.AddFromFile(binInclude);

                            // No need to iterate the rest of the projects
                            // We've found the Web project already.
                            break;
                        }
                    }
                }
            }

            // Log end of step
            LogEventEnd(title);
            Log("");
        }