private static void BuildWebApiProject(string solutionDirectory, IFileSystem fileSystem) { var webApiProjectClassPath = ClassPathHelper.WebApiProjectClassPath(solutionDirectory); WebApiCsProjBuilder.CreateWebApiCsProj(solutionDirectory); Utilities.ExecuteProcess("dotnet", $@"sln add ""{webApiProjectClassPath.FullClassPath}"" --solution-folder {"Api"}", solutionDirectory); // base folders Directory.CreateDirectory(ClassPathHelper.ControllerClassPath(solutionDirectory, "").ClassDirectory); Directory.CreateDirectory(ClassPathHelper.WebApiExtensionsClassPath(solutionDirectory, "").ClassDirectory); Directory.CreateDirectory(ClassPathHelper.WebApiMiddlewareClassPath(solutionDirectory, "").ClassDirectory); WebApiServiceExtensionsBuilder.CreateWebApiServiceExtension(solutionDirectory, fileSystem); WebApiAppExtensionsBuilder.CreateWebApiAppExtension(solutionDirectory, fileSystem); ErrorHandlerMiddlewareBuilder.CreateErrorHandlerMiddleware(solutionDirectory, fileSystem); AppSettingsBuilder.CreateAppSettings(solutionDirectory); LaunchSettingsBuilder.CreateLaunchSettings(solutionDirectory, fileSystem); WebApiProgramBuilder.CreateWebApiProgram(solutionDirectory, fileSystem); StartupBuilder.CreateStartup(solutionDirectory, "Startup", null); }
private static void BuildWebApiProject(string solutionDirectory, string projectDirectory, string projectBaseName, bool useJwtAuth, string dbName, IFileSystem fileSystem) { var solutionFolder = projectDirectory.Replace(solutionDirectory, "").Replace(Path.DirectorySeparatorChar.ToString(), ""); var webApiProjectClassPath = ClassPathHelper.WebApiProjectClassPath(projectDirectory, projectBaseName); WebApiCsProjBuilder.CreateWebApiCsProj(projectDirectory, projectBaseName); Utilities.ExecuteProcess("dotnet", $@"sln add ""{webApiProjectClassPath.FullClassPath}"" --solution-folder {solutionFolder}", solutionDirectory); // base folders Directory.CreateDirectory(ClassPathHelper.ControllerClassPath(projectDirectory, "", projectBaseName, "v1").ClassDirectory); Directory.CreateDirectory(ClassPathHelper.WebApiExtensionsClassPath(projectDirectory, "", projectBaseName).ClassDirectory); Directory.CreateDirectory(ClassPathHelper.WebApiMiddlewareClassPath(projectDirectory, "", projectBaseName).ClassDirectory); WebApiServiceExtensionsBuilder.CreateWebApiServiceExtension(projectDirectory, projectBaseName, fileSystem); WebApiAppExtensionsBuilder.CreateWebApiAppExtension(projectDirectory, projectBaseName, fileSystem); ErrorHandlerMiddlewareBuilder.CreateErrorHandlerMiddleware(projectDirectory, projectBaseName, fileSystem); WebApiAppSettingsBuilder.CreateAppSettings(projectDirectory, new ApiEnvironment(), dbName, projectBaseName); // empty environment so i can get a blank with all the right keys. don't care about values as they get overriden by env specific settings WebApiLaunchSettingsBuilder.CreateLaunchSettings(projectDirectory, projectBaseName, fileSystem); ProgramBuilder.CreateWebApiProgram(projectDirectory, projectBaseName, fileSystem); StartupBuilder.CreateWebApiStartup(projectDirectory, "Production", useJwtAuth, projectBaseName); }