Skip to content

Commit

Permalink
Build & publish to local folder script
Browse files Browse the repository at this point in the history
  • Loading branch information
xmegz committed Jun 6, 2024
1 parent dc9250d commit f0a3f4e
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,8 @@ ASALocalRun/

# MFractors (Xamarin productivity tool) working folder
.mfractor/

# Build directories
**/build


2 changes: 1 addition & 1 deletion MndpTray/MndpService.Core/MndpService.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
<OutputType>Exe</OutputType>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<SignAssembly>true</SignAssembly>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
Expand All @@ -11,7 +8,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<_TargetId>Folder</_TargetId>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<SelfContained>false</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
Expand Down
119 changes: 119 additions & 0 deletions MndpTray/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#
# To enable script execution, run at admin powershell prompt
# 'set-executionpolicy remotesigned'
#

$SolutionFolderPath=$PSScriptRoot
$BuildFolderPath="$SolutionFolderPath\Build"

echo "SolutionFolderPath: $SolutionFolderPath";
echo "BuildFolderPath: $BuildFolderPath";


#
# Remove & Clean Output Folder
#

if (Test-Path -LiteralPath $BuildFolderPath)
{
Remove-Item -LiteralPath $BuildFolderPath -Verbose -Recurse -WhatIf
}
md -Force $BuildFolderPath



#
# Publish Console
#

$ProjectsConsole = @(
'MndpService.Core'
)

$ProfilesConsole = @(
'win-x64'
'win-x64-full'
'linux-x64'
'linux-x64-full'
)


foreach ( $Project in $ProjectsLinux )
{
echo ""
echo "Project: [$Project]"
echo ""
dotnet clean -c Release $SolutionFolderPath\$Project
dotnet build -c Release $SolutionFolderPath\$Project

foreach ( $Profile in $ProfilesConsole )
{
echo ""
echo "Profile: [$Profile]"
echo ""

dotnet publish -c Release $SolutionFolderPath\$Project /p:PublishProfile=$Profile
}
}


#
# Copy output
#
foreach ( $Project in $ProjectsConsole )
{
echo ""
echo "Copy: [$Project]"
echo ""

Copy-Item -Verbose -Path $SolutionFolderPath\$Project\bin\Release\net8.0\publish\win-x64\$Project.exe -Destination $BuildFolderPath\$Project.exe
Copy-Item -Verbose -Path $SolutionFolderPath\$Project\bin\Release\net8.0\publish\win-x64-full\$Project.exe -Destination $BuildFolderPath\$Project.Full.exe
Copy-Item -Verbose -Path $SolutionFolderPath\$Project\bin\Release\net8.0\publish\linux-x64\$Project -Destination $BuildFolderPath\$Project
Copy-Item -Verbose -Path $SolutionFolderPath\$Project\bin\Release\net8.0\publish\linux-x64-full\$Project -Destination $BuildFolderPath\$Project.Full
}


#
# Publish Windows
#

$ProjectsWindows = @(
'MndpTray.Core'
)

$ProfilesWindows = @(
'win-x64'
'win-x64-full'
)


foreach ( $Project in $ProjectsWindows )
{
echo ""
echo "Project: [$Project]"
echo ""
dotnet clean -c Release $SolutionFolderPath\$Project
dotnet build -c Release $SolutionFolderPath\$Project

foreach ( $Profile in $ProfilesWindows )
{
echo ""
echo "Profile: [$Profile]"
echo ""

dotnet publish -c Release $SolutionFolderPath\$Project /p:PublishProfile=$Profile
}
}

#
# Copy output
#
foreach ( $Project in $ProjectsWindows )
{
echo ""
echo "Copy: [$Project]"
echo ""

Copy-Item -Verbose -Path $SolutionFolderPath\$Project\bin\Release\net8.0-windows\publish\win-x64\$Project.exe -Destination $BuildFolderPath\$Project.exe
Copy-Item -Verbose -Path $SolutionFolderPath\$Project\bin\Release\net8.0-windows\publish\win-x64-full\$Project.exe -Destination $BuildFolderPath\$Project.Full.exe
}

0 comments on commit f0a3f4e

Please sign in to comment.