无法加载文件或程序集"itextsharp"或其依赖项之一 [英] Could not load file or assembly 'itextsharp' or one of its dependencies
问题描述
尝试遵循 这个RazorPDF教程,我不知道为什么会收到以下错误消息:非常沮丧和疲倦.
Trying to follow this tutorial for RazorPDF, and I don't know why am I getting the following error message: Very frustrated and tired.
错误消息:
无法加载文件或程序集'itextsharp'或其中之一 依赖关系.找到的程序集的清单定义不 匹配程序集参考. (来自HRESULT的异常:0x80131040)
Could not load file or assembly 'itextsharp' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
itextsharp:
itextsharp:
RunTimeVersion:v1.1.4322 版本:4.1.2.0
RunTimeVersion: v1.1.4322 Version: 4.1.2.0
RazorPDF:
运行时版本:4.0.30319
Run Time version: 4.0.30319
在控制器内部:
public ActionResult Index()
{
var studentMarks = new List<MarksCard>()
{
new MarksCard()
{
RollNo = 101, Subject = "C#",
FullMarks = 100, Obtained = 90},new MarksCard() {RollNo = 101, Subject = "asp.net", FullMarks = 100, Obtained = 80},new MarksCard() {RollNo = 101, Subject = "MVC", FullMarks = 100,
Obtained = 100},new MarksCard() {RollNo = 101, Subject = "SQL Server", FullMarks = 100, Obtained = 75},
};
//// return new RazorPDF.PdfResult(studentMarks, "Index");
return View(studentMarks);
}
内部视图
@model IEnumerable<TimberBeamCalculator.Models.MarksCard>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.RollNo)
</th>
<th>
@Html.DisplayNameFor(model => model.Subject)
</th>
<th>
@Html.DisplayNameFor(model => model.FullMarks)
</th>
<th>
@Html.DisplayNameFor(model => model.Obtained)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.RollNo)
</td>
<td>
@Html.DisplayFor(modelItem => item.Subject)
</td>
<td>
@Html.DisplayFor(modelItem => item.FullMarks)
</td>
<td>
@Html.DisplayFor(modelItem => item.Obtained)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
</td>
</tr>
}
</table>
推荐答案
检查以确保您确实将iTextSharp放入了正确的位置.我的猜测是您遗漏了一些东西.
Check to be sure that you actually have iTextSharp going into the correct place. My guess is you are missing something.
我强烈建议您从遵循初始项目示例开始,并尝试使它们首先工作.
I'd strongly suggest you start by following the initial project samples and trying to get them to work first.
- 简介视频(2分钟的视频,向您展示如何使其正常工作. )
- Github的示例项目
- Intro video (2 mins video showing you what to do to make it work.)
- Sample projects of Github
这篇关于无法加载文件或程序集"itextsharp"或其依赖项之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!