结合CLR类库发布ASP.NET vNext/DNX

Posted

技术标签:

【中文标题】结合CLR类库发布ASP.NET vNext/DNX【英文标题】:Publishing ASP.NET vNext / DNX combined with CLR class library 【发布时间】:2015-08-12 21:17:07 【问题描述】:

我已将我的“传统”DAL 项目添加到 ASP.NET vNext 并在本地对其进行工作/调试,没有任何问题。但是当我尝试将它发布到 Azure 时,它​​不会。它指出'3>由于构建错误而发布失败。查看错误列表以获取更多详细信息。',但错误列表中有0,项目运行良好。

那么是否可以将“旧”4.5.1 项目与 DNX 目标项目结合起来?如果是这样,现在发布只是目前的问题还是其他问题?

作为一种解决方法,我尝试创建一个 DNX 类库,但这不允许我(在 VS 2015 中)使用“浏览”按钮添加引用,因此我无法将旧类库移植为新格式我还需要 2 个 DLL。

构建日志

3>------ Publish started: Project: Example.Kitchen, Configuration: Release Any CPU ------
Project "Example.Kitchen.xproj" (MSDeployPublish target(s)):
    Building with tools version "14.0".
    Task "Error" skipped, due to false condition; ( '$(_InvalidConfigurationError)' == 'true' ) was evaluated as ( '' == 'true' ).
    Task "Warning" skipped, due to false condition; ( '$(_InvalidConfigurationWarning)' == 'true' ) was evaluated as ( '' == 'true' ).
    Configuration=Debug
    Platform=AnyCPU
    Task "Error" skipped, due to false condition; ('$(OutDir)' != '' and !HasTrailingSlash('$(OutDir)')) was evaluated as ('..\artifacts\bin\Example.Kitchen\' != '' and !HasTrailingSlash('..\artifacts\bin\Example.Kitchen\')).
    Task "Error" skipped, due to false condition; ('$(BaseIntermediateOutputPath)' != '' and !HasTrailingSlash('$(BaseIntermediateOutputPath)')) was evaluated as ('..\artifacts\obj\Example.Kitchen\' != '' and !HasTrailingSlash('..\artifacts\obj\Example.Kitchen\')).
    Task "Error" skipped, due to false condition; ('$(IntermediateOutputPath)' != '' and !HasTrailingSlash('$(IntermediateOutputPath)')) was evaluated as ('..\artifacts\obj\Example.Kitchen\Debug\' != '' and !HasTrailingSlash('..\artifacts\obj\Example.Kitchen\Debug\')).
    Using "GetRuntimeToolingPath" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.Tasks.dll".
    Task "Error" skipped, due to false condition; (!Exists('$(RuntimeToolingExe)')) was evaluated as (!Exists('C:\Users\Gabriel\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta6\bin\dnx.exe')).
    Using "DefaultExternalToolsPath" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.Tasks.dll".
    Using "GetRuntimeVersion" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.Tasks.dll".
    rmdir /S /Q "C:\Users\Gabriel\AppData\Local\Temp\PublishTemp\"
    Using "Dnu" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\..\DNX\Microsoft.DNX.Tasks.dll".
    Environment variables:
    Path=D:\Development\dotnet\Example\Example.Kitchen\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\extensions\microsoft\web tools\external;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft Emulator Manager\1.0\;C:\Program Files (x86)\nodejs\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Users\Gabriel\.dnx\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Git\cmd;C:\Program Files\nodejs\;C:\Python27\;C:\Python27\Scripts;C:\Users\Gabriel\AppData\Roaming\npm";C:\Users\Gabriel\AppData\Roaming\npm;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\extensions\microsoft\web tools\external\.git
    C:\Users\Gabriel\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta6\bin\dnu.cmd publish "D:\Development\dotnet\Example\Example.Kitchen" --out "C:\Users\Gabriel\AppData\Local\Temp\PublishTemp" --configuration Debug --runtime dnx-clr-win-x86.1.0.0-beta6 --wwwroot-out "wwwroot" --quiet
    Microsoft .NET Development Utility CLR-x86-1.0.0-beta6-12256
    Copying to output path C:\Users\Gabriel\AppData\Local\Temp\PublishTemp
    Time elapsed 00:00:03.4408766
Done building project "Example.Kitchen.xproj" -- FAILED.

3>Publish failed due to build errors. Check the error list for more details.
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

【问题讨论】:

错误列表(Visual Studio 窗口)中有哪些错误(如果有)? @Gabriël 我遇到了同样的问题。刚刚向github.com/aspnet/dnx/issues/2467 添加了一个测试仓库github.com/petrsvihlik/aspnet5_deploytest(猜这是你的问题:)) 我猜这就是现在的答案...... 他们已经关闭了错误github.com/aspnet/dnx/pull/2745 :D 它适用于最新的位? 【参考方案1】:

修复我已有的东西

如果您不想升级,可以尝试从项目目录运行以下命令:

C:\Users\Gabriel\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta6\bin\dnu.cmd publish "D:\Development\dotnet\Example\Example.Kitchen" --out "C:\Users\Gabriel\AppData\Local\Temp\PublishTemp" --configuration Debug --runtime dnx-clr-win-x86.1.0.0-beta6 --wwwroot-out "wwwroot" --quiet

但是,删除--quiet 标志并确保运行dnvm list 以确保您拥有dnx-clr-win-x86.1.0.0-beta6 运行时。

推荐步骤:

我认为这已经在最新的beta8 中解决了。

确保update to the latest version (RC1)(包括工具)并确保您没有使用旧包(没有 beta6/beta8)。

另外,请务必查看 RC1 中引入的breaking changes。

【讨论】:

以上是关于结合CLR类库发布ASP.NET vNext/DNX的主要内容,如果未能解决你的问题,请参考以下文章

S2第一章

ASP.NET vNext Core CLR 的模块化功能

ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出

asp.net与asp.net 优缺点

.NET Framework包括哪3种技术

(超简单基础版)ASP.NET(.Net Framework)三层架构,结合sql server实现登录与注册