当我尝试更新Dapper(或任何其他NuGet包)时,Visual Studio会显示:
An error occurred while writing file 'T:\ProjectPath\packages.config': Packages node does not exists in packages.config at T:\ProjectPath\packages.config.
所述文件的确切内容为:
<?xml version="1.0" encoding="utf-8"?>
<packages xmlns="urn:packages">
<package id="Antlr" version="3.5.0.2" targetFramework="net45" xmlns="" />
<package id="Dapper" version="1.42" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" xmlns="" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net451" xmlns="" />
<package id="Moment.js" version="2.10.2" targetFramework="net451" xmlns="" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net451" xmlns="" />
<package id="NLog" version="4.0.1" targetFramework="net451" xmlns="" />
<package id="NLog.Config" version="4.0.1" targetFramework="net451" xmlns="" />
<package id="NLog.Schema" version="4.0.1" targetFramework="net451" xmlns="" />
<package id="Oracle.ManagedDataAccess" version="12.1.021" targetFramework="net451" xmlns="" />
<package id="WebGrease" version="1.6.0" targetFramework="net45" xmlns="" />
</packages>
包节点肯定存在。
我尝试过update-package dapper
,update-package dapper -Reinstall
和uninstall-package dapper -Force
。所有产量:
PM> Update-Package dapper
Attempting to gather dependency information for multiple packages with respect to project 'ImplantRecipeDatabase', targeting '.NETFramework,Version=v4.5.1'
Attempting to resolve dependencies for multiple packages.
Resolving actions install multiple packages
Install failed. Rolling back...
Package 'Dapper 1.42' already exists in project 'ImplantRecipeDatabase'
Update-Package : An error occurred while writing file 'T:\Dropbox\WorkProjects\DataManager\ImplantRecipeDatabase\packages.config': Packages node does not exists in packages.config at T:\Dropbox\WorkProjects\DataManager\ImplantRecipeDatabase\packages.config.
At line:1 char:15
+ Update-Package <<<< dapper
+ CategoryInfo : NotSpecified: (:) [Update-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand
请注意,撰写本文时NuGet发现的最新版本的Dapper是1.50.1
错误没有用,所以我不知道从哪里开始。我已经尝试安装VS2015 Update 3(kb3165756)的最新更新,并拥有最新版本的NuGet(3.4.4.1321)。 我接下来应该尝试什么?
答案 0 :(得分:3)
您的packages.config文件看起来不正确。它具有xmlns属性,其中普通的packages.config不具有任何属性。将root packages元素放在不同的命名空间中可能是问题的原因。我希望packages.config文件看起来更像:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Antlr" version="3.5.0.2" targetFramework="net45" />