Пример #1
0
        /// <summary>
        /// Returns an ASP.NET Core environment-specific JSON file-name for a base file-name and ASP.NET Core environment name.
        /// </summary>
        public static FileName GetJsonFileNameForEnvironment(FileNameWithoutExtension baseFileNameWithoutExtension, string aspNetCoreEnvironmentName)
        {
            var fileNameWithoutExtension = PathUtilities.Combine(baseFileNameWithoutExtension, aspNetCoreEnvironmentName.AsFileNameSegment()).AsFileNameWithoutExtension();

            var output = PathUtilities.GetFileName(fileNameWithoutExtension, FileExtensions.Json);

            return(output);
        }
Пример #2
0
        public static NuspecFileName GetNuspecFileName(PackageID packageID)
        {
            var packageFileSystemName          = Utilities.GetPackageNuspecFileSystemName(packageID);
            var nuspecFileNameWithoutExtension = Utilities.GetNuspecFileNameWithoutExtension(packageFileSystemName);
            var nuspecFileName = PathUtilities.GetFileName(nuspecFileNameWithoutExtension, NuspecFileExtension.Instance).AsNuspecFileName();

            return(nuspecFileName);
        }
Пример #3
0
        public static NupkgFileName GetNupkgFileName(PackageID packageID, Version version)
        {
            var packageFileSystemName         = Utilities.GetPackageNupkgFileSystemName(packageID);
            var versionFileSystemName         = Utilities.GetVersionFileSystemName(version);
            var nupkgFileNameWithoutExtension = Utilities.GetNupkgFileNameWithoutExtension(packageFileSystemName, versionFileSystemName);

            var nupkgFileName = PathUtilities.GetFileName(nupkgFileNameWithoutExtension, FileExtensions.Nupkg).AsNupkgFileName();

            return(nupkgFileName);
        }
        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}");
            }
        }
Пример #6
0
        public static SolutionFileName GetSolutionFileName(FileNameWithoutExtension solutionFileNameWithoutExtension)
        {
            var solutionFileName = PathUtilities.GetFileName(solutionFileNameWithoutExtension, FileExtensions.Sln).AsSolutionFileName();

            return(solutionFileName);
        }
Пример #7
0
        public static ProjectFileName GetProjectFileName(ProjectFilePath projectFilePath)
        {
            var projectFileName = PathUtilities.GetFileName(projectFilePath).AsProjectFileName();

            return(projectFileName);
        }
Пример #8
0
        public static ProjectFileName GetCSharpProjectFileName(FileNameWithoutExtension projectfileNameWithoutExtension)
        {
            var projectFileName = PathUtilities.GetFileName(projectfileNameWithoutExtension, CSharpProjectFileExtension.Instance).AsProjectFileName();

            return(projectFileName);
        }