【问题标题】:CI build fails in Visual Studio Team Services (was Visual Studio Online) - dnvm issue?Visual Studio Team Services 中的 CI 构建失败(是 Visual Studio Online) - dnvm 问题?
【发布时间】:2016-06-25 03:45:03
【问题描述】:

我正在尝试在 Visual Studio Team Services(之前是 Visual Studio Online)中设置构建定义(Visual Studio),但出现以下错误:

C:\程序文件 (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets(126,5): 错误:需要安装 Dnx 运行时包。查看输出 窗口了解更多详情。

我尝试添加一个Command Line pre-build step,它将运行dnvm upgrade,但它仍然不起作用。我也试过dnvm install 1.0.0-rc1-final -r clr -arch x86,但没有成功。

该项目只是一个空的 Web 应用程序模板。

另外我应该提到我对这个工具链很陌生,我意识到我可能错过了一两步。谢谢。

编辑: 我尝试了here(dnvm 升级)提出的解决方案,但它没有用,并且产生了一堆错误(这正是我可以放入 ss 中的): see errors here。我应该补充一点,我无法运行 dnu restore,因为它显然未被识别为命令。

我还觉得奇怪的是,它没有按预期工作,因为它是您可以设置的最基本的操作。

【问题讨论】:

标签: visual-studio build continuous-integration clr azure-devops


【解决方案1】:

您可以创建一个 power-shell 脚本来安装 dnx 运行时并恢复 dnu 包。

# bootstrap DNVM into this session.
&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}

# load up the global.json so we can find the DNX version
$globalJson = Get-Content -Path $PSScriptRoot\global.json -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore

if($globalJson)
{
    $dnxVersion = $globalJson.sdk.version
}
else
{
    Write-Warning "Unable to locate global.json to determine using 'latest'"
    $dnxVersion = "latest"
}

# install DNX
# only installs the default (x86, clr) runtime of the framework.
# If you need additional architectures or runtimes you should add additional calls
# ex: & $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r coreclr
& $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -Persistent

 # run DNU restore on all project.json files in the src folder including 2>1 to redirect stderr to stdout for badly behaved tools
Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }

有关详细信息,请参阅此链接中的 power-shell 部分:Build and Deploy your ASP.NET 5 Application to an Azure Web App

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-03-18
    • 2017-03-10
    • 2017-11-26
    • 1970-01-01
    • 2015-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多