“ Csc”任务意外失败,无法从程序集mscorlib Version = 4.0.0.0,

时间:2019-10-23 14:33:08

标签: c# asp.net visual-studio dependencies .net-assembly

在MS Visual Studio 2017中构建项目时,它出现上述错误,我尝试使用还原NuGet包,而visuals studio显示此错误,请帮助解决该问题

"The "Csc" task failed unexpectedly.
System.TypeLoadException: Could not load type 'System.ValueTuple`3' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at Microsoft.CodeAnalysis.BuildTasks.ManagedToolTask.GenerateCommandLineCommands()
   at Microsoft.Build.Utilities.ToolTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() AppModelv2-WebApp-OpenIDConnect-DotNet          
"

1 个答案:

答案 0 :(得分:1)

.NET 4.6.2或更低版本

您需要安装NuGet软件包System.ValueTuple。

$("#download").addEventListener("click", () => {
  let e = !1,
    t = !1,
    r = !1,
    i = !1,
    s = 0;
  if (o.getObjects().forEach(o => {
      let n = o.top + o.height,
        l = o.left + o.width;
      (!1 === e || o.top < e) && (e = o.top), (!1 === r || n > r) && (r = n), (!1 === t || o.left < t) && (t = o.left), (!1 === i || l > i) && (i = l), s += 1
    }), s < 2) return alert(i18n.msg("no_objects"));
  const l = document.createElement("a"),
    a = r - e + 124,
    d = i - t + 124,
    c = new fabric.Rect({
      fill: "white",
      top: -o.height,
      left: -o.width,
      width: 4 * o.width,
      height: 4 * o.height,
      hasBorders: !1,
      hasControls: !1,
      selectable: !1
    }),
    h = new fabric.IText(n, {
      textAlign: "left",
      fontFamily: "sans-serif",
      fontSize: 24,
      fill: "black",
      top: e - 40,
      left: t,
      width: o.width
    });
  o.add(c, h), c.sendToBack(), l.href = o.toDataURL({
    format: "pdf",
    top: e - 50,
    left: t - 50,
    width: d,
    height: a
  }), l.download = `${n}.pdf`, l.style.display = "block", document.body.appendChild(l), l.click(), document.body.removeChild(l), o.remove(c), o.remove(h)
}),

如果这不起作用,请执行以下步骤。

1。找到您项目的包文件夹

2。删除文件夹

3。重建项目