我在尝试安装包Microsoft.AspNet.Server.IIS
Attempting to resolve dependency 'Microsoft.AspNet.Loader.IIS.Interop (≥ 1.0.0-alpha4-10330)'.
Attempting to resolve dependency 'Microsoft.AspNet.Loader.IIS (≥ 1.0.0-alpha4-10330)'.
'Microsoft.AspNet.Loader.IIS' already has a dependency defined for 'Microsoft.AspNet.FeatureModel'.
如何解决?
更新: 我还得到以下内容:
Attempting to resolve dependency 'Microsoft.Framework.DependencyInjection (≥ 1.0.0-alpha4-10326)'.
'Microsoft.Framework.DependencyInjection' already has a dependency defined for 'Microsoft.Framework.ConfigurationModel'.
答案 0 :(得分:136)
通过安装最新的NuGet Package Manager解决了这个问题:
https://visualstudiogallery.msdn.microsoft.com/4ec1526c-4a8c-4a84-b702-b21a8f5293ca
不要忘记重新启动VisualStudio。
答案 1 :(得分:63)
我在我的解决方案中解决了类似的问题:
nuget update -self
这将我的解决方案中的NuGet.exe副本从2.8.0升级到3.4.4,修复了'X'已经为'Y'错误定义的依赖关系阻止它下载SSH.NET在建造之前自动。
(如果您的解决方案中没有NuGet.exe的副本 - 而且可能没有 - 那么您应该尝试TN的答案中的解决方案)
答案 2 :(得分:18)
我尝试了更新,但它对我不起作用。帮助
答案 3 :(得分:5)
我在TeamCity构建服务器上遇到了这个问题。我尝试在构建服务器上更新NuGet(通过TC)但是没有用。我终于通过更改"更新模式"来解决了这个问题。从解决方案文件到packages.config的Nuget Installer构建步骤。
答案 4 :(得分:3)
我在TeamCity构建服务器上遇到问题library(MASS)
library(sperrorest)
library(parallel)
library(pbapply)
currentSample <- partition.cv(maipo, nfold = 4)
currentSample[[2]] <- partition.cv(maipo, nfold = 4)[[1]]
currentRes <- currentSample
lda.predfun <- function(object, newdata, fac = NULL) {
library(nnet)
majority <- function(x) {
levels(x)[which.is.max(table(x))]
}
majority.filter <- function(x, fac) {
for (lev in levels(fac)) {
x[ fac == lev ] <- majority(x[ fac == lev ])
}
x
}
pred <- predict(object, newdata = newdata)$class
if (!is.null(fac)) pred <- majority.filter(pred, newdata[,fac])
return(pred)
}
data("maipo", package = "sperrorest")
predictors <- colnames(maipo)[5:ncol(maipo)]
fo <- as.formula(paste("croptype ~", paste(predictors, collapse = "+")))
# pblapply attempt (not working)
runreps_res <- pblapply(cl = 2, currentSample, function(X)
runreps(currentSample = X, data = maipo,
formula = fo, par.mode = 1, pred.fun = lda.predfun,
do.try = FALSE, model.fun = lda,
error.fold = TRUE, error.rep = TRUE, do.gc = 1,
err.train = TRUE, importance = FALSE, currentRes = currentRes,
pred.args = list(fac = "field"), response = "croptype", par.cl = 2,
coords = c("x", "y"), progress = 1, pooled.obs.train = c(),
pooled.obs.test = c(), err.fun = err.default))
# mclapply attempt (not working)
runreps_res <- mclapply(mc.cores = 2, currentSample, function(X)
runreps(currentSample = X, data = maipo,
formula = fo, par.mode = 1, pred.fun = lda.predfun,
do.try = FALSE, model.fun = lda,
error.fold = TRUE, error.rep = TRUE, do.gc = 1,
err.train = TRUE, importance = FALSE, currentRes = currentRes,
pred.args = list(fac = "field"), response = "croptype", par.cl = 2,
coords = c("x", "y"), progress = 1, pooled.obs.train = c(),
pooled.obs.test = c(), err.fun = err.default))
# lapply attempt (working)
runreps_res <- lapply(currentSample, function(X)
runreps(currentSample = X, data = maipo,
formula = fo, par.mode = 1, pred.fun = lda.predfun,
do.try = FALSE, model.fun = lda,
error.fold = TRUE, error.rep = TRUE, do.gc = 1,
err.train = TRUE, importance = FALSE, currentRes = currentRes,
pred.args = list(fac = "field"), response = "croptype", par.cl = 2,
coords = c("x", "y"), progress = 1, pooled.obs.train = c(),
pooled.obs.test = c(), err.fun = err.default))
。
我将Nuget安装程序构建步骤的“更新模式”从解决方案文件更改为 packages.config 和 NuGet.exe 到最新版本(我有3.5.0)并且它有效!!
答案 5 :(得分:2)
答案 6 :(得分:2)
我在过时版本的Visual Studio 2010上遇到此错误。由于项目配置,我无法将此版本更新为更新版本。因此,上面提到的NuGet的更新并没有为我解决问题。
此类和类似情况中出错的根本原因是您尝试安装的软件包的依赖项,这与您项目中可用的.NET版本不兼容。
通用解决方案不是Visual Studio或.NET的强制更新,而是安装与您的系统兼容的相同软件包的旧NuGet版本。
无法确定哪些早期版本可行。在我的例子中,这个命令安装了包,没有任何NuGet更新。
Install-Package X -Version [compatible version number]
答案 7 :(得分:1)
在我的情况下,我必须删除项目文件夹 /。nuget中的文件NuGet.exe并重建项目。
我还在NuGet.targets中将DownloadNuGetExe标记为true:
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">true</DownloadNuGetExe>
希望它有所帮助。
答案 8 :(得分:0)
对我有用的唯一解决方案是从Visual Studio 2013中完全卸载nuget,然后再次安装它,同时重新启动VS.
答案 9 :(得分:0)
完成。
答案 10 :(得分:0)
在使用vs 2010的项目中,我只能通过“软件包管理器控制台”安装所需的较旧版本的软件包来解决此问题。
此命令有效:
PM> Install-Package EPPlus -Version 4.5.3.1
此命令无效:
PM> Install-Package EPPlus -Version 4.5.3.2