我正在尝试按照这个 RazorPDF 教程进行操作,但是我不知道为什么会出现以下错误信息:非常沮丧和疲惫。
错误信息:
无法加载文件或程序集 'itextsharp' 的一个或多个依赖项。所定位的程序集清单定义与程序集引用不匹配。(来自 HRESULT: 0x80131040 的异常)
itextsharp:
运行时版本:v1.1.4322 版本:4.1.2.0
RazorPDF:
运行时版本: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>