diff --git a/README.md b/README.md
index 02f12fe..34cc17e 100644
--- a/README.md
+++ b/README.md
@@ -2,10 +2,36 @@
[![Nuget](https://img.shields.io/nuget/v/SpatialFocus.FocusInit)](https://www.nuget.org/packages/SpatialFocus.FocusInit/)
+Initialize an empty folder for a new project by copying and modifying files from our [repository-template](https://github.com/SpatialFocus/repository-template). This includes:
+
+- .gitignore and .editorconfig
+- stylecop.json and ReSharper settings
+- MSBuild properties
+- Solution file including the default _Solution Items_ solution folder
+- README.md
+
+Placeholders in these files will be filled with solution name and author information.
+
+Additionally, the wizard supports the creation of .NET Core projects in the solution. Currently, these project templates are available:
+
+1) Console app
+2) Empty web
+3) Web API
+4) Web MVC
+5) Xamarin Forms Shell (using our [Xamarin Forms Shell template](https://github.com/SpatialFocus/DotNetNew.XamarinFormsShell))
+6) Blazor Server
+7) Blazor Wasm
+
+After setting up one of these demo projects, typical generic projects can be added as well:
+
+- Business (class library for business logic)
+- Shared (class library for shared data)
+- Test (nunit test project)
+
## Install the dotnet tool
```
-dotnet tool install --global SpatialFocus.FocusInit --version 0.2.0
+dotnet tool install --global SpatialFocus.FocusInit --version 0.3.0
```
Install the tool globally. You can invoke the tool using the following command: `focus-init`
@@ -32,12 +58,21 @@ d----- 13.05.2020 15:19 NewConsoleProject
PS C:\temp> cd .\NewConsoleProject\
PS C:\temp\NewConsoleProject> focus-init
+
+ __ _ _ _
+ / _| ___ ___ _ _ ___ (_)_ __ (_) |_
+ | |_ / _ \ / __| | | / __|_____| | '_ \| | __|
+ | _| (_) | (__| |_| \__ \_____| | | | | | |_
+ |_| \___/ \___|\__,_|___/ |_|_| |_|_|\__|
+
+
+Initialize this folder for a new project.
Enter solution name [NewConsoleProject]
Enter company name [Spatial Focus GmbH]
Template repository cloned successfully.
Solution files have been copied and modified.
Create additional projects? [Y/n] n
-Finished.
+Finished. Have fun!
PS C:\temp\NewConsoleProject> dir
diff --git a/src/FocusInit/DotnetCliHelper.cs b/src/FocusInit/DotnetCliHelper.cs
index 82ed80a..414cf0a 100644
--- a/src/FocusInit/DotnetCliHelper.cs
+++ b/src/FocusInit/DotnetCliHelper.cs
@@ -48,16 +48,17 @@ public string CreateMultiProject(string type)
return $"{srcFolder}/{SolutionName}";
}
- public string CreateProject(string type, string projectSuffix)
+ public string CreateProject(string type, string projectSuffix = null)
{
string srcFolder = !string.IsNullOrEmpty(WorkDir) ? WorkDir + "/src" : "src";
+ string projectName = !string.IsNullOrEmpty(projectSuffix) ? $"{SolutionName}.{projectSuffix}" : SolutionName;
- string createProjectCmd = $"new {type} -n {SolutionName}.{projectSuffix} -o {srcFolder}/{SolutionName}.{projectSuffix}";
+ string createProjectCmd = $"new {type} -n {projectName} -o {srcFolder}/{projectName}";
Process process = Process.Start("dotnet", createProjectCmd);
process.WaitForExit(3000);
- return $"{srcFolder}/{SolutionName}.{projectSuffix}";
+ return $"{srcFolder}/{projectName}";
}
public void InstallCustomProjectTemplate(string type)
diff --git a/src/FocusInit/FileSystemHelper.cs b/src/FocusInit/FileSystemHelper.cs
index d5e5bc1..c7975df 100644
--- a/src/FocusInit/FileSystemHelper.cs
+++ b/src/FocusInit/FileSystemHelper.cs
@@ -10,14 +10,28 @@ public class FileSystemHelper
{
public void CleanupAndCreateWorkDir()
{
- if (Directory.Exists(Settings.WorkingDir))
+ if (!string.IsNullOrEmpty(Settings.WorkingDir) && !Directory.Exists(Settings.WorkingDir))
{
- // Deal with readonly files (typically in .git folder)
- SetDirectoryNormal(Settings.WorkingDir);
- Directory.Delete(Settings.WorkingDir, true);
+ Directory.CreateDirectory(Settings.WorkingDir);
+ return;
}
- Directory.CreateDirectory(Settings.WorkingDir);
+ string targetDirectory = !string.IsNullOrEmpty(Settings.WorkingDir) ? Settings.WorkingDir : Directory.GetCurrentDirectory();
+
+ DirectoryInfo currentDirectory = new DirectoryInfo(targetDirectory);
+
+ // Deal with readonly files (typically in .git folder)
+ SetDirectoryNormal(currentDirectory.FullName);
+
+ foreach (FileInfo file in currentDirectory.GetFiles())
+ {
+ file.Delete();
+ }
+
+ foreach (DirectoryInfo dir in currentDirectory.GetDirectories())
+ {
+ dir.Delete(true);
+ }
}
public void DeleteRepository()
diff --git a/src/FocusInit/FocusInit.csproj b/src/FocusInit/FocusInit.csproj
index 2788360..d98798e 100644
--- a/src/FocusInit/FocusInit.csproj
+++ b/src/FocusInit/FocusInit.csproj
@@ -8,7 +8,7 @@