示例#1
0
        public static SolutionFilePath GetSolutionFilePath(SolutionDirectoryPath solutionDirectoryPath, SolutionName solutionName, DotnetNewConventions conventions)
        {
            var solutionFileName = Utilities.GetSolutionFileName(solutionName, conventions);

            var solutionFilePath = VsIoUtilities.GetSolutionFilePath(solutionDirectoryPath, solutionFileName);

            return(solutionFilePath);
        }
        /// <summary>
        /// The "dotnet new sln" command allows specifying the directory in which to produce a solution file, and the name of the solution.
        /// However, it does not allows specifying the exact file path of the output solution file.
        /// </summary>
        public static SolutionFilePath CreateSolutionFile(SolutionDirectoryPath solutionDirectoryPath, SolutionName solutionName, ILogger logger)
        {
            var solutionFilePath = Utilities.GetSolutionFilePath(solutionDirectoryPath, solutionName);

            logger.LogDebug($"{solutionName} - Creating solution file:\n{solutionFilePath}");

            // Notes:
            //  --output: This must be the directory in which the solution file should be placed (tested).
            //  --name: This is the name of the solution, to which the .sln extension will be added. If .sln is suffixed to the name argument the resulting solution file will be .sln.sln!
            var arguments = $@"new sln --output ""{solutionDirectoryPath}"" --name {solutionName}";

            ProcessRunner.Run(DotnetCommand.Value, arguments);

            logger.LogInformation($"{solutionName} - Created solution file:\n{solutionFilePath}");

            return(solutionFilePath);
        }
        public static SolutionDirectoryPath AsSolutionDirectoryPath(this string value)
        {
            var solutionDirectoryPath = new SolutionDirectoryPath(value);

            return(solutionDirectoryPath);
        }
示例#4
0
        /// <summary>
        /// Uses the <see cref="DotnetNewConventions.Instance"/>.
        /// </summary>
        public static SolutionFilePath GetSolutionFilePath(SolutionDirectoryPath solutionDirectoryPath, SolutionName solutionName)
        {
            var solutionFilePath = Utilities.GetSolutionFilePath(solutionDirectoryPath, solutionName, DotnetNewConventions.Instance);

            return(solutionFilePath);
        }