diff --git a/docs/site/Writerside/topics/Create-a-NET-Console-Project.topic b/docs/site/Writerside/topics/Create-a-NET-Console-Project.topic index 34a1ba5..e825161 100644 --- a/docs/site/Writerside/topics/Create-a-NET-Console-Project.topic +++ b/docs/site/Writerside/topics/Create-a-NET-Console-Project.topic @@ -4,9 +4,94 @@ xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd" id="Create-a-NET-Console-Project" title="Create a .NET Console Project"> - - Create a .NET Console Project - -

Start typing here...

+ Create a .NET Console Project + + +

Creating a .NET console project is a foundational step for many developers working in the .NET ecosystem. This documentation outlines how to use the MasterCommander's InitializeConsoleProjectAsync method to streamline this process.

+
+ + +

Before you begin, ensure you have the following installed:

+ +
  • .NET 8 SDK or later
  • +
  • Git command line tool
  • +
  • Visual Studio Code or another code editor
  • +
    +
    + + +

    This method automates the creation of a new .NET console project, configures it within a solution, and prepares it for release. It simplifies several steps into a single asynchronous operation, improving developer productivity.

    +
    + + +

    The following sequence diagram illustrates the process executed by the InitializeConsoleProjectAsync method:

    + + @startuml + actor Developer + participant "MasterCommander API" as API + participant "Git CLI" as Git + participant "Dotnet CLI" as Dotnet + participant "FileSystem" as FS + + Developer -> API: Initialize Console Project Async + API -> FS : Set Working Directory + API -> API: Display Startup Message Async + API -> Git: git init Async + Git -> API: Repo Initialized + API -> Dotnet: dotnet new gitignore Async + API -> Dotnet: dotnet new editorconfig Async + API -> Dotnet: dotnet new nugetconfig Async + API -> Dotnet: dotnet new globaljson\n(SdkVersion = "8.0.101") Async + API -> Dotnet: dotnet new sln\n(OutputName = "AppDemo") Async + API -> Dotnet: dotnet new console\n(OutputName = "AppDemo.Console", OutputDirectory = "AppDemoConsoleDir") Async + API -> Dotnet: dotnet sln add "AppDemo.Console.csproj" Async + API -> Git: git add "*" Async + API -> Git: git commit "Initial commit" Async + API -> Dotnet: dotnet build Async + API -> Dotnet: dotnet build\n(Configuration = "Release") Async + API -> Dotnet: dotnet run\n(Project = "AppDemo.Console.csproj", Configuration = "Release") Async + API -> FS: Compress Solution Directory Async + + note right of API: Asynchronous operations are denoted\nby "Async" for clarity. + note right of API: Compression step matches the C# method's action. + @enduml + +

    This diagram provides a visual representation of the interactions between the developer, MasterCommander API, and other components during project initialization.

    +
    + + +

    The following C# code snippet shows a practical implementation of the InitializeConsoleProjectAsync method:

    + + public async Task InitializeConsoleProjectAsync() + { + SetWorkingDirectory(); + + console.WriteStartupMessage(); + + await git.InitAsync(); + + await dotnet.NewAsync(new DotnetNewGitignoreOptions()); + await dotnet.NewAsync(new DotnetNewEditorConfigOptions()); + await dotnet.NewAsync(new DotnetNewNuGetConfigOptions()); + await dotnet.NewAsync(new DotnetNewGlobalJsonOptions { SdkVersion = SdkVersion }); + await dotnet.NewAsync(new DotnetNewSolutionOptions { OutputName = SolutionName }); + await dotnet.NewAsync(new DotnetNewConsoleOptions { OutputName = ConsoleProjectName, OutputDirectory = ConsoleProjectDirectory }); + await dotnet.SlnAddAsync(ConsoleCsproj); + + await git.AddAsync("*"); + await git.CommitAsync("Initial commit"); + + await dotnet.BuildAsync(); + await dotnet.BuildAsync(new DotnetBuildOptions { Configuration = "Release" }); + await dotnet.RunAsync(new DotnetRunOptions { Project = ConsoleCsproj, Configuration = "Release" }); + + CompressSolutionDirectory(); + } + +
    + + +

    By following the steps outlined in this documentation, you have successfully created a .NET console project using an efficient and streamlined process. Explore further by adding more features to your console application or integrating it with other services.

    +
    diff --git a/docs/site/Writerside/web.tree b/docs/site/Writerside/web.tree index 7923314..b89e70d 100644 --- a/docs/site/Writerside/web.tree +++ b/docs/site/Writerside/web.tree @@ -7,9 +7,11 @@ start-page="starter-topic.md"> - + + +