Skip to content

Commit 6befc9a

Browse files
authored
Merge pull request #42 from Jackpieking/F11
2 parents eb00f1f + e2273e4 commit 6befc9a

File tree

265 files changed

+1313
-962
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

265 files changed

+1313
-962
lines changed

Scripts/Clean/clean.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Write-Output "Project root path determined: $projectRoot"
5454
Set-Location $projectRoot
5555

5656
Write-Output "Clean project..."
57-
dotnet clean -c $CONFIGURATION_MODE .\SetupProject.sln
57+
dotnet clean -c $CONFIGURATION_MODE
5858
if ($LASTEXITCODE -ne 0) {
5959
Write-Error "dotnet format failed"
6060
exit $LASTEXITCODE

Scripts/Clean/clean.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ echo "Project root path determined: $project_root"
4545
cd "$project_root"
4646

4747
echo "Clean project..."
48-
dotnet clean -c "$CONFIGURATION_MODE" "./SetupProject.sln"
48+
dotnet clean -c "$CONFIGURATION_MODE"
4949
if [ $? -ne 0 ]; then
5050
echo "dotnet format failed"
5151
exit 1

Scripts/PublishApp/publish.ps1

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,65 @@
22
# Run this file for publishing and check the out assets
33
# In out folder (situated in SETUPPROJECT/out)
44

5+
# Change this to your project name
6+
$PROJECT_NAME = 'ASPNET_CORE_VSA_Template'
7+
58
# Set error handling
69
$ErrorActionPreference = "Stop"
710

11+
# Constants
12+
$CURRENT_PATH = Get-Location
13+
$CONFIGURATION_MODE = 'Release'
14+
15+
# Function to find the root directory containing the solution file
16+
function Find-ProjectRoot {
17+
param (
18+
[string] $currentDir
19+
)
20+
21+
while ($true) {
22+
# Try to find the sln in the current directory, if found, return something
23+
# otherwise, nothing return
24+
#
25+
# First 1 is from the first of the list, take 1 element
26+
$slnFile = Get-ChildItem -Path $currentDir -Filter *.sln -ErrorAction SilentlyContinue | Select-Object -First 1
27+
if ($slnFile) {
28+
return $currentDir
29+
}
30+
31+
# Try to back 1 level directory since, the sln is
32+
# always in the root directory, so must go back
33+
# not going forward
34+
#
35+
# Then we assign new path to current dir
36+
$parentDir = Split-Path -Path $currentDir -Parent
37+
if ($parentDir -contains $PROJECT_NAME) {
38+
return $null
39+
}
40+
$currentDir = $parentDir
41+
}
42+
43+
return $null
44+
}
45+
46+
# Determine the project root path containing the solution file
47+
$projectRoot = Find-ProjectRoot -currentDir $(Split-Path -Path $MyInvocation.MyCommand.Path -Parent)
48+
if (-not $projectRoot) {
49+
Write-Error "No solution file (.sln) found in the directory hierarchy."
50+
exit 1
51+
}
52+
53+
# Set to working directory to project root
54+
Write-Output "Project root path determined: $projectRoot"
55+
Set-Location $projectRoot
56+
857
# Format the project
958
Write-Output "Publish project..."
10-
dotnet publish -c Release --no-build --no-restore
59+
dotnet publish -c $CONFIGURATION_MODE
1160
if ($LASTEXITCODE -ne 0) {
1261
Write-Error "dotnet publish failed"
1362
exit $LASTEXITCODE
1463
}
64+
65+
# Set back to original directory
66+
Set-Location $CURRENT_PATH

Scripts/PublishApp/publish.sh

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,53 @@
44
# Run this file for publishing and check the out assets
55
# In out folder (situated in SETUPPROJECT/out)
66

7-
# Set error handling
7+
# Change this to your project name
8+
PROJECT_NAME="ASPNET_CORE_VSA_Template"
9+
10+
# Exit on errors
811
set -e
912

13+
# Constants
14+
CONFIGURATION_MODE="Release"
15+
CURRENT_PATH=$(pwd)
16+
17+
# Function to find the root directory containing the solution file
18+
find_project_root() {
19+
current_dir=$1
20+
while true; do
21+
# Try to find the .sln file in the current directory
22+
sln_file=$(find "$current_dir" -maxdepth 1 -name "*.sln" -print -quit)
23+
if [ -n "$sln_file" ]; then
24+
echo "$current_dir"
25+
return
26+
fi
27+
28+
# Try to go up one directory level
29+
parent_dir=$(dirname "$current_dir")
30+
if [[ "$parent_dir" != *"$PROJECT_NAME"* ]]; then
31+
return
32+
fi
33+
current_dir="$parent_dir"
34+
done
35+
}
36+
37+
# Determine the project root path containing the solution file
38+
project_root=$(find_project_root "$(dirname "$(realpath "$0")")")
39+
if [ -z "$project_root" ]; then
40+
echo "No solution file (.sln) found in the directory hierarchy."
41+
exit 1
42+
fi
43+
44+
# Set to working directory to project root
45+
echo "Project root path determined: $project_root"
46+
cd "$project_root"
47+
1048
# Format the project
1149
echo "Publish project..."
12-
if ! dotnet publish -c Release --no-build --no-restore; then
50+
if ! dotnet publish -c "$CONFIGURATION_MODE"; then
1351
echo "dotnet publish failed"
1452
exit 1
15-
fi
53+
fi
54+
55+
# Go back to original directory
56+
cd "$CURRENT_PATH"

Scripts/Run/run.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ $ErrorActionPreference = "Stop"
99

1010
# Constants
1111
$CURRENT_PATH = Get-Location
12+
$CONFIGURATION_MODE = 'Release'
1213

1314
# Function to find the root directory containing the solution file
1415
function Find-ProjectRoot {
@@ -63,7 +64,7 @@ if ($LASTEXITCODE -ne 0) {
6364
Set-Location $CURRENT_PATH
6465

6566
Write-Output "Run project..."
66-
dotnet run -c Release --project $projectRoot\Src\Entry\Entry.Src\
67+
dotnet run -c $CONFIGURATION_MODE --project $projectRoot\Src\Entry\
6768
if ($LASTEXITCODE -ne 0) {
6869
Write-Error "dotnet run failed"
6970
exit $LASTEXITCODE

Scripts/Run/run.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ PROJECT_NAME="ASPNET_CORE_VSA_Template"
1010
set -e
1111

1212
# Constants
13+
CONFIGURATION_MODE="Release"
1314
CURRENT_PATH=$(pwd)
1415

1516
# Function to find the root directory containing the solution file
@@ -51,10 +52,10 @@ if [ $? -ne 0 ]; then
5152
fi
5253

5354
# Go back to original directory
54-
cd "$CURRENT_PATH
55+
cd "$CURRENT_PATH"
5556

5657
echo "Run project..."
57-
dotnet run -c Release --project "$project_root/Src/Entry/Entry.Src/"
58+
dotnet run -c "$CONFIGURATION_MODE" --project "$project_root/Src/Entry/"
5859
if [ $? -ne 0 ]; then
5960
echo "dotnet run failed"
6061
exit 1

0 commit comments

Comments
 (0)