在VSO中构建ASP.NET 5项目 [英] Building ASP.NET 5 project in VSO

查看:47
本文介绍了在VSO中构建ASP.NET 5项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法获得VSO来构建ASP.NET 5项目.获取软件包似乎存在问题.

I cannot get VSO to build ASP.NET 5 projects. There seems to be an issue getting the packages.

在VSO中构建步骤:

我在VS 2015中构建了项目,并选中了还原NuGet软件包".

I have the project building in VS 2015 and have "Restore NuGet Packages" checked.

构建控制台输出:

******************************************************************************
Starting task: Build solution $/Root/TestApi/Development/TestApi.sln
******************************************************************************
Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\tasks\VSBuild\1.0.13\VSBuild.ps1
C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe "C:\a\dce2e497\Root\TestApi.sln" /nologo /m /nr:false /fl /flp:"logfile=C:\a\dce2e497\Root\TestApi.sln.log" /dl:CentralLogger,"C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agent\worker\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"*ForwardingLogger,"C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agent\worker\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="C:\a\dce2e497\staging" /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="14.0"
Build started 8/2/2015 11:21:29 AM.
     1>Project "C:\a\dce2e497\Root\TestApi.sln" on node 1 (default targets).
     1>ValidateSolutionConfiguration:
         Building solution configuration "release|any cpu".
     1>Project "C:\a\dce2e497\Root\TestApi.sln" (1) is building "C:\a\dce2e497\Root\TestApi.Api\TestApi.Api.xproj" (2) on node 1 (default targets).
     2>PrepareForBuild:
         Creating directory "..\artifacts\bin\TestApi.Api\".
         Creating directory "..\artifacts\obj\TestApi.Api\Release\".
       PreComputeCompileTypeScript:
         C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.4\tsc.exe  --noEmitOnError COMPUTE_PATHS_ONLY
       CompileTypeScript:
       Skipping target "CompileTypeScript" because it has no outputs.
       CoreCompile:
         C:\Users\buildguest\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta6\bin\dnx.exe --appbase "C:\a\dce2e497\Root\TestApi.Api" "C:\Users\buildguest\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta6\bin\lib\Microsoft.Framework.PackageManager\Microsoft.Framework.PackageManager.dll" pack "C:\a\dce2e497\Root\TestApi.Api" --configuration Release --out "..\artifacts\bin\TestApi.Api"
         Microsoft .NET Development Utility CLR-x86-1.0.0-beta6-12256
         Building TestApi.Api for DNX,Version=v4.5.1
           Using Project dependency TestApi.Api 1.0.0
             Source: C:\a\dce2e497\Root\TestApi.Api\project.json
           Unable to resolve dependency Microsoft.AspNet.Server.IIS 1.0.0-beta6
    TestApi.Api\Startup.cs(5,17): Error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
     2>C:\a\dce2e497\Root\TestApi.Api\Startup.cs(5,17): DNX,Version=v4.5.1 error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\a\dce2e497\Root\TestApi.Api\TestApi.Api.xproj]
TestApi.Api\Startup.cs(6,17): Error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
     2>C:\a\dce2e497\Root\TestApi.Api\Startup.cs(6,17): DNX,Version=v4.5.1 error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\a\dce2e497\Root\TestApi.Api\TestApi.Api.xproj]

请注意,这特定于NuGet软件包还原.请参考我的答案以解决问题.

Note that this is specific to NuGet package restore. Refer to my answer for the fix.

推荐答案

我使用以下步骤安装DNVM,DNX并为在src中找到的每个project.json文件调用dnu restore:

I used the following step to install DNVM, DNX and to call dnu restore for each project.json file found in src:

# 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 }

请参阅此MSDN帖子.

这篇关于在VSO中构建ASP.NET 5项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆