为NPM构建步骤设置环境变量

时间:2018-11-20 17:47:33

标签: npm azure-devops

使用我的开发机上的终端,我可以做到这一点...

Module modDataBases
Private dbConnection As New OleDb.OleDbConnection
ReadOnly dbProvider As String = "PROVIDER=MICROSOFT.ACE.OLEDB.12.0;"
Private dbSource As String
Private dbDataSet As New DataSet
Private dbDataAdapter As OleDb.OleDbDataAdapter
Private intFN As Integer = 0
Private dbtest(10) As New DataSet ‘ Is for the different Names needed in   DataAdapter
Public dsNames(10)

Public Sub OpenDatabaseConnection(strLocation As String, strDatabase As String, strSQLCommand As String)

On Error GoTo ErrorHandling

For intFN = 0 To dbQTY
        dbSource = "Data Source = " & strLocation & "\" & dbNames(intFN) &  dbExtention
 dbConnection.ConnectionString = dbProvider & dbSource

 dbConnection.Closen() ‘ Only to be sure the Connection is closed
 Application.DoEvents()


        dbConnection.Open()
        Application.DoEvents()

        dbDataAdapter = New OleDb.OleDbDataAdapter(strSQLCommand, dbConnection)
        dbDataAdapter.Fill(dbDataSet, dbTest(intFN))
 dbConnection.Closen()

 dsNames(intFN) = dbDataSet or if not possible as array then dsnames = dbDataSet


    Next

End sub

...,并且可以使用...在代码中访问SOME_VARIABLE

SOME_VARIABLE=http://localhost:3000/ npm start

在Azure DevOps中使用NPM版本step,如何设置相同的环境变量?

我无法在“命令和参数”文本字段中添加变量,因为它们是在生成的对npm的调用之后之后添加的。

此外,如果我复制可在开发机上运行的命令并从命令行任务中运行它,我认为它不会接受命令格式,因为它是Windows。

1 个答案:

答案 0 :(得分:1)

现有答案可能不是您想要的。您要做的就是建立设置>变量并在那里声明

https://docs.microsoft.com/en-us/azure/devops/pipelines/build/options?view=vsts&tabs=yaml#variables