public static void CreateProjectFile(DotnetNewProjectType projectType, ProjectFilePath projectFilePath, DotnetNewConventions conventions, ILogger logger)
        {
            var projectDirectoryPath            = PathUtilities.GetDirectoryPath(projectFilePath).AsProjectDirectoryPath();
            var projectFileName                 = PathUtilities.GetFileName(projectFilePath).AsProjectFileName();
            var projectFileNameWithoutExtension = PathUtilities.GetFileNameWithoutExtension(projectFileName);
            var projectName = conventions.ProjectNameFromProjectFileNameWithoutExtension(projectFileNameWithoutExtension);

            var createdProjectFilePath = DotnetCommandServicesProvider.CreateProjectFile(projectType, projectName, projectDirectoryPath, logger);

            // Throw an exception if the solution file-path created by dotnet new is not the one we were expecting.
            if (createdProjectFilePath.Value != projectFilePath.Value)
            {
                throw new Exception($"Project creation file path mismatch.\nExpected: {projectFilePath}\nCreated: {createdProjectFilePath}");
            }
        }
 /// <summary>
 /// Uses the <see cref="DotnetNewConventions.Instance"/>.
 /// </summary>
 public static void CreateProjectFile(DotnetNewProjectType projectType, ProjectFilePath projectFilePath, ILogger logger)
 {
     DotnetCommandServicesProvider.CreateProjectFile(projectType, projectFilePath, DotnetNewConventions.Instance, logger);
 }
 public static void CreateProjectFile(DotnetNewProjectType projectType, ProjectFilePath projectFilePath)
 {
     DotnetCommandServicesProvider.CreateProjectFile(projectType, projectFilePath, DummyLogger.Instance);
 }
Esempio n. 4
0
 public void CreateProjectFile(DotnetNewProjectType projectType, ProjectFilePath projectFilePath)
 {
     DotnetCommandServicesProvider.CreateProjectFile(projectType, projectFilePath, this.Logger);
 }