Cake 脚本 - 无法引用 .Net 4.6 库

Cake Script - Unable to refer .Net 4.6 library

这是我的蛋糕脚本。

#reference "System.IO.Compression.dll";
#reference "System.IO.Compression.FileSystem.dll";
using System;

var target = Argument("target", "Default");

Task("UnzipDoc")
    .Does(() =>
{   
    System.IO.Compression.ZipArchive archive = System.IO.Compression.ZipFile.OpenRead("test.zip");  
});

Task("Default")
    .IsDependentOn("UnzipDoc");

RunTarget(target);

使用 build 执行此脚本。ps1 给出 ZipArchive 不存在的错误。

我在安装了 VS2015 的 Windows 7 64 位机器上使用 Cake v0.26.1。

要在 GAC 中引用程序集,请省略文件扩展名 (.dll),因此它只显示 "System.IO.Compression",表示也有用于解压缩的内置别名。

Unzip("Cake.zip", "./cake");

ZipAliases Unzip

阅读更多内容