2 Star 2 Fork 1

MASA Stack/MASA.Templates

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build-nuget.ps1 1.70 KB
一键复制 编辑 原始数据 按行查看 历史
MayueCif 提交于 2023-07-27 15:59 . feat:update mf 1.0.0 (#61)
$scriptDir = split-path -parent $MyInvocation.MyCommand.Definition
$srcDir = (Join-Path -path $scriptDir src)
# nuget.exe needs to be on the path or aliased
function Reset-Templates{
[cmdletbinding()]
param(
[string]$templateEngineUserDir = (join-path -Path $env:USERPROFILE -ChildPath .templateengine)
)
process{
'resetting dotnet new templates. folder: "{0}"' -f $templateEngineUserDir | Write-host
get-childitem -path $templateEngineUserDir -directory | Select-Object -ExpandProperty FullName | remove-item -recurse
&dotnet new --debug:reinit
}
}
function Clean(){
[cmdletbinding()]
param(
[string]$rootFolder = $scriptDir
)
process{
'clean started, rootFolder "{0}"' -f $rootFolder | write-host
# delete folders that should not be included in the nuget package
Get-ChildItem -path $rootFolder -include bin,obj,nupkg -Recurse -Directory | Select-Object -ExpandProperty FullName | Remove-item -recurse
}
}
# start script
Clean
# create nuget package
$outputpath = Join-Path $scriptDir nupkg
$pathtonuspec = Join-Path $srcDir templates.nuspec
if(Test-Path $pathtonuspec){
nuget.exe pack $pathtonuspec -OutputDirectory $outputpath
}
else{
'ERROR: nuspec file not found at {0}' -f $pathtonuspec | Write-Error
return
}
$pathtonupkg = join-path $scriptDir nupkg/Masa.Template.1.0.0.nupkg
# install nuget package using dotnet new install
if(test-path $pathtonupkg){
Reset-Templates
'installing template with command "dotnet new install {0}"' -f $pathtonupkg | write-host
&dotnet new install $pathtonupkg
}
else{
'Not installing template because it was not found at "{0}"' -f $pathtonupkg | Write-Error
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/masastack/MASA.Templates.git
git@gitee.com:masastack/MASA.Templates.git
masastack
MASA.Templates
MASA.Templates
main

搜索帮助