Skip to content

Commit

Permalink
Merge pull request #29 from phmatray/features/documentation
Browse files Browse the repository at this point in the history
Documentation - Create a .NET Console Project
  • Loading branch information
phmatray authored Feb 21, 2024
2 parents 7c8e686 + f4d3602 commit 113c3f3
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 5 deletions.
93 changes: 89 additions & 4 deletions docs/site/Writerside/topics/Create-a-NET-Console-Project.topic
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<title>
Create a .NET Console Project
</title>
<p>Start typing here...</p>
<title>Create a .NET Console Project</title>

<chapter id="Overview" title="Overview">
<p>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 <code>InitializeConsoleProjectAsync</code> method to streamline this process.</p>
</chapter>

<chapter id="Prerequisites" title="Prerequisites">
<p>Before you begin, ensure you have the following installed:</p>
<list type="decimal">
<li>.NET 8 SDK or later</li>
<li>Git command line tool</li>
<li>Visual Studio Code or another code editor</li>
</list>
</chapter>

<chapter id="Process-Description" title="Step-by-Step Process">
<p>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.</p>
</chapter>

<chapter id="Sequence-Diagram" title="Sequence Diagram">
<p>The following sequence diagram illustrates the process executed by the <code>InitializeConsoleProjectAsync</code> method:</p>
<code-block lang="plantuml">
@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
</code-block>
<p>This diagram provides a visual representation of the interactions between the developer, MasterCommander API, and other components during project initialization.</p>
</chapter>

<chapter id="Example-Implementation" title="Example Implementation">
<p>The following C# code snippet shows a practical implementation of the <code>InitializeConsoleProjectAsync</code> method:</p>
<code-block lang="c#">
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();
}
</code-block>
</chapter>

<chapter id="Conclusion-and-Next-Steps" title="Conclusion and Next Steps">
<p>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.</p>
</chapter>

</topic>
4 changes: 3 additions & 1 deletion docs/site/Writerside/web.tree
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
start-page="starter-topic.md">

<toc-element topic="MasterCommander.topic">
<toc-element topic="Overview.topic"/>
<toc-element topic="Installing-MasterCommander.topic"/>
</toc-element>
<toc-element topic="Overview.topic"/>
<toc-element topic="Overview.topic"/>
</toc-element>
<toc-element topic="Tutorials.topic">
</toc-element>
<toc-element topic="How-Tos.topic">
Expand Down

0 comments on commit 113c3f3

Please sign in to comment.