public static PackageID GetDefaultPackageID(ProjectFileName projectFileName) { var projectFileNameWithoutExtension = PathUtilities.GetFileNameWithoutExtension(projectFileName); var packageID = Utilities.GetDefaultPackageID(projectFileNameWithoutExtension); return(packageID); }
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> /// Creates a solution file at the specified file-path. /// </summary> /// <remarks> /// This method feeds the solution directory-path and solution-name value required to have the dotnet new command create a solution-file at the specified path. /// </remarks> public static void CreateSolutionFile(SolutionFilePath solutionFilePath, DotnetNewConventions conventions, ILogger logger) { var solutionDirectoryPath = PathUtilities.GetDirectoryPath(solutionFilePath).AsSolutionDirectoryPath(); var solutionFileName = PathUtilities.GetFileName(solutionFilePath).AsSolutionFileName(); var solutionFileNameWithoutExtension = PathUtilities.GetFileNameWithoutExtension(solutionFileName); var solutionName = conventions.SolutionNameFromSolutionFileNameWithoutExtension(solutionFileNameWithoutExtension); var createdSolutionFilePath = DotnetCommandServicesProvider.CreateSolutionFile(solutionDirectoryPath, solutionName, logger); // Throw an exception if the solution file-path created by dotnet new is not the one we were expecting. if (createdSolutionFilePath.Value != solutionFilePath.Value) { throw new Exception($"Solution creation file path mismatch.\nExpected: {solutionFilePath}\nCreated: {createdSolutionFilePath}"); } }
public static FileNameWithoutExtension GetNupkgFileNameWithoutExtension(PackageFileSystemName packageFileSystemName, VersionFileSystemName versionFileSystemName) { var nupkgFileNameWithoutExtension = PathUtilities.GetFileNameWithoutExtension(packageFileSystemName, versionFileSystemName); return(nupkgFileNameWithoutExtension); }