更新到 beta8 后无法发布 asp.net 5 应用程序 - 依赖项......无法解决
Posted
技术标签:
【中文标题】更新到 beta8 后无法发布 asp.net 5 应用程序 - 依赖项......无法解决【英文标题】:Can't publish asp.net 5 application after update to beta8 - the dependency ... could not be resolved 【发布时间】:2015-10-16 16:11:31 【问题描述】:我已将 webApi asp.net5 应用程序更新为 beta8,无法再发布到文件系统。
构建似乎工作,我可以调试和运行应用程序,但如果我尝试发布,我会得到这样的错误......
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(156,5): Error : Build failed.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(11,20): Error NU1001: The dependency AntiXSS >= 4.2.1 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(12,24): Error NU1001: The dependency Devshed.Csv >= 1.3.8 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(13,27): Error NU1001: The dependency Devshed.Shared >= 1.3.7 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(14,22): Error NU1001: The dependency DotNetZip >= 1.9.2 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(15,29): Error NU1001: The dependency Iesi.Collections >= 3.2.0.4000 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(16,25): Error NU1001: The dependency MongoDB.Bson >= 2.0.0 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(17,27): Error NU1001: The dependency MongoDB.Driver >= 2.0.0 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(18,32): Error NU1001: The dependency MongoDB.Driver.Core >= 2.0.0 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(19,23): Error NU1001: The dependency NHibernate >= 3.3.4.4000 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(20,17): Error NU1001: The dependency NLog >= 4.1.2 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(21,24): Error NU1001: The dependency NLog.Config >= 4.1.2 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(22,24): Error NU1001: The dependency NLog.Schema >= 4.0.1 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(23,31): Error NU1001: The dependency System.Data.SQLite >= 1.0.90 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(24,24): Error NU1001: The dependency LibInternal >= 1.0.0-* could not be resolved.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(156,5): Error : Build failed.
3>Publish failed due to build errors. Check the error list for more details.
========== Build: 2 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
这是 Project.json 文件:
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies":
"Microsoft.AspNet.Cors": "6.0.0-beta8",
"Microsoft.AspNet.Hosting": "1.0.0-beta8",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8",
"Microsoft.AspNet.Mvc": "6.0.0-beta8",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta8",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta8",
"MongoDB.Driver": "2.0.1"
,
"commands":
"web": "Microsoft.AspNet.Server.Kestrel"
,
"frameworks":
"dnx451":
"dependencies":
"LibInternal.Database": "1.0.0-*"
,
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
]
LibInternal.Database 是一个 .NET Framework 4.5 项目。
这是来自 LibInternal.Database 的 packages.config:
<packages>
<package id="AntiXSS" version="4.2.1" targetFramework="net45" />
<package id="Devshed.Csv" version="1.3.8" targetFramework="net45" />
<package id="Devshed.Shared" version="1.3.7" targetFramework="net45" />
<package id="DotNetZip" version="1.9.2" targetFramework="net45" />
<package id="Iesi.Collections" version="3.2.0.4000" targetFramework="net45" />
<package id="MongoDB.Bson" version="2.0.0" targetFramework="net45" />
<package id="MongoDB.Driver" version="2.0.0" targetFramework="net45" />
<package id="MongoDB.Driver.Core" version="2.0.0" targetFramework="net45" />
<package id="NHibernate" version="3.3.4.4000" targetFramework="net45" />
<package id="NLog" version="4.1.2" targetFramework="net45" />
<package id="NLog.Config" version="4.1.2" targetFramework="net45" />
<package id="NLog.Schema" version="4.0.1" targetFramework="net45" />
<package id="System.Data.SQLite" version="1.0.90.0" targetFramework="net45" />
</packages>
这是 .pubxml 文件:
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<CompileSource>False</CompileSource>
<UsePowerShell>False</UsePowerShell>
<WebRoot>wwwroot</WebRoot>
<WwwRootOut>wwwroot</WwwRootOut>
<IncludeSymbols>False</IncludeSymbols>
<Native>False</Native>
<IgnoreDNXRuntime>False</IgnoreDNXRuntime>
<publishUrl>D:\Publish\WebAPI</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PublishDNXVersion>dnx-clr-win-x64.1.0.0-beta8</PublishDNXVersion>
</PropertyGroup>
</Project>
有人有什么想法吗?
【问题讨论】:
你更新了visual studio吗?这里链接microsoft.com/en-us/download/details.aspx?id=49442 是的,我做到了。我认为没有其他方法可以安装 beta8。 请分享project.json文件 LibInternal.Database 有哪些依赖? 您能否在发布时检查您的目标 DNX 版本。看看它是否仍然指向 beta 7? 【参考方案1】:经过几个小时的研究和与微软开发人员的交谈,我可以说这是一个错误。
这是 Microsoft 团队的一个已知问题,希望它会在下一个测试版中得到修复。我可以通过这两个步骤来解决这个问题:
在解决方案文件夹中应该有一个名为“wrap”的子文件夹。在此文件夹中是包含 project.json 文件的子文件夹。在这个文件中,我必须将“net45”更改为“dnx451”。
我不得不更改 bin 文件夹中子文件夹的名称:
\project\wrapLibraryName\bin\Release\net45 => \project\wrapLibraryName\bin\Release\dnx451
之后我可以发布到文件系统。
【讨论】:
您能否显示整个 project.json,也不清楚您更改了哪个 project.json,因为每个项目都有一个。我在 rc1-update1 上遇到了这个问题。我可以构建/调试但不能发布。 我已经更新到 rc1 update 1 并且不能再重现这个错误了。你试过这个吗?这是微软的一个已知错误。我认为它已修复。以上是关于更新到 beta8 后无法发布 asp.net 5 应用程序 - 依赖项......无法解决的主要内容,如果未能解决你的问题,请参考以下文章
具有 Authorize 属性的 ASP.NET 5 beta8 CORS 不起作用