30 lines
1.1 KiB
Batchfile
30 lines
1.1 KiB
Batchfile
@echo off
|
||
setlocal
|
||
rem 切到仓库根目录(scripts 的上一级)
|
||
cd /d "%~dp0\.."
|
||
|
||
rem NativeAOT 的原生链接需要 MSVC 工具链,先用 vswhere 找到 VS 并配置环境
|
||
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
|
||
if exist "%VSWHERE%" (
|
||
for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VSPATH=%%i"
|
||
)
|
||
if defined VSPATH if exist "%VSPATH%\VC\Auxiliary\Build\vcvars64.bat" (
|
||
echo === Configure MSVC env: %VSPATH% ===
|
||
call "%VSPATH%\VC\Auxiliary\Build\vcvars64.bat" >nul
|
||
)
|
||
|
||
echo === NativeAOT publish (win-x64) -^> bin\notify.exe ===
|
||
dotnet publish Notify -c Release -r win-x64 -p:PublishAot=true -o bin
|
||
if errorlevel 1 (
|
||
echo.
|
||
echo *** publish failed. If link.exe not found, run from "Developer Command Prompt for VS" ***
|
||
exit /b 1
|
||
)
|
||
|
||
rem 清理发布目录残留:只留 notify.exe(AOT 下 -o 拷贝时序使 csproj 内清理不可靠,这里统一处理)
|
||
del /q bin\*.pdb bin\*.dll bin\*.lib >nul 2>&1
|
||
|
||
echo.
|
||
echo === Done: %CD%\bin\notify.exe ===
|
||
endlocal
|