-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateSolution.ps1
More file actions
47 lines (34 loc) · 1.19 KB
/
createSolution.ps1
File metadata and controls
47 lines (34 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$Time = [System.Diagnostics.Stopwatch]::StartNew()
function PrintElapsedTime {
Log $([string]::Format("Elapsed time: {0}.{1}", $Time.Elapsed.Seconds, $Time.Elapsed.Milliseconds))
}
function Log {
Param ([string] $s)
Write-Output "###### $s"
}
function Check {
Param ([string] $s)
if ($LASTEXITCODE -ne 0) {
Log "Failed: $s"
throw "Error case -- see failed step"
}
}
$FolderToCreate = Join-Path -Path $PSScriptRoot -ChildPath 'src'
If(!(Test-Path -path "$FolderToCreate\"))
{
#if it does not create it
New-Item -ItemType "directory" -Force -Path $FolderToCreate
}
Set-Location -Path $FolderToCreate
dotnet new sln -n dotnet-dockerbuild
dotnet new webapp -n WebAppOne
dotnet new webapp -n WebAppTwo
dotnet new classlib -n LibOne
dotnet add "WebAppOne/WebAppOne.csproj" reference "LibOne/LibOne.csproj"
dotnet add "WebAppTwo/WebAppTwo.csproj" reference "LibOne/LibOne.csproj"
dotnet sln dotnet-dockerbuild.sln add "WebAppOne/WebAppOne.csproj"
dotnet sln dotnet-dockerbuild.sln add "WebAppTwo/WebAppTwo.csproj"
dotnet sln dotnet-dockerbuild.sln add "LibOne/LibOne.csproj"
dotnet restore dotnet-dockerbuild.sln
Set-Location -Path $PSScriptRoot
PrintElapsedTime