我有一个Azure bot服务解决方案,它位于我的VSTS Git存储库中。
我在visual studio中使用Task Runner在我的本地计算机上编译,运行和调试代码。
同样,我想在我的VSTS构建管道中构建和编译代码,就像我们使用Visual Studio模板为.Net应用程序构建一样
我对拥有C#脚本文件的Bot服务项目非常陌生。
我看过msdn文档都提到了Continuous Integration,它会直接链接到我的Git repo分支。每当我提交代码时它会自动推送到My Azure Bot服务,在这里我想确保我提交的代码应该在推送到Azure Bot服务之前进行编译。为此,我想设置一个Build管道。
有谁知道如何为具有C#脚本文件的这类项目设置构建管道?
更新
在我的本地PC中,我已经安装了Azure Functions CLI工具,以及Visual Studio Runner扩展到visual studio。我按照以下链接启用本地调试 enter link description here
任务运行器运行debughost.cmd文件,它在我的Bot服务代码中,它包含以下代码
@echo off
set size=0
call func settings list -data > %temp%\settings-list
call :filesize %temp%\settings-list
if NOT %size% == 0 goto show
@echo ----------------------------------------------------------------------
@echo To fetch your bot service settings run the following command:
@echo func azure functionapp fetch-app-settings [YOUR_BOT_SERVICE_NAME]
@echo func azure functionapp fetch-app-settings AthenaDevbvpn6xsu2tz6i
@echo ----------------------------------------------------------------------
goto start
:show
type %temp%\settings-list
erase %temp%\settings-list
:start
@func host start -p 3978
goto :eof
:filesize
set size=%~z1
exit /b 0
任务运行器中的输出是
答案 0 :(得分:2)
现在没有任何开箱即用的任务来编译CSX文件。以下是我可以为您的方案考虑的解决方法,但这并不完美:
以下是我创建的powershell脚本供您参考:
##Run Azure Func command to compile csx file
$compile = Start-Process 'func' -passthru -WorkingDirectory '.' -ArgumentList 'host start -p 3739' -RedirectStandardOutput 'output.txt'
##You need to set the sleep time base on the build time of your project
Start-Sleep -s 20
Stop-Process $compile -Force
Stop-Process -Name 'Func'
##Get the output from Func and check if there is error in the output
$boutput = Get-Content 'output.txt'
Write-Host 'Azure Function CLI Log:'
Write-Host '*****************************************************************************************************************************'
$boutput
Write-Host '*****************************************************************************************************************************'
$reg = "Function.compilation.error"
foreach($line in $boutput){
if($line -match $reg)
{
##Fail the task if function compilation error exist
Write-Host '##vso[task.logissue type=error]Error occur during function compilation'
Exit 1
}
}
Write-Host 'Function compilation success!'
答案 1 :(得分:1)
对于Azure Bot Service,在VSTS中设置与存储库的主分支的持续集成,对于VSTS中的存储库,您可以创建新的分支,例如Dev,然后使用Dev分支并合并到master。之后,代码将更新为azure。
简单步骤: