Tôi có dự án SSIS với tôi, tôi có thể chạy như vậy. Tuy nhiên, khi tôi cố gắng để chỉnh sửa nó cho thấy một lỗiTên 'zipfile' không tồn tại trong ngữ cảnh hiện tại
Tên 'zipfile' không tồn tại trong bối cảnh hiện nay
với ra chỉnh sửa nó hoạt động tốt đang
Lỗi:
public void Main()
{
// TODO: Add your code here
string moduleName = Dts.Variables["User::ModuleName"].Value.ToString();
string s = Dts.Variables["User::ZipFileLocation"].Value.ToString().TrimEnd('\\') + "\\" + moduleName + "\\" + moduleName + "_" + DateTime.Now.ToString("ddMMyyyy");
// TODO: Add your code here
string startPath = s;
string zipPath = s + ".zip";
try
{
File.Delete(zipPath);
ZipFile.CreateFromDirectory(startPath, zipPath);
}
catch (Exception e)
{
}
Dts.TaskResult = (int)ScriptResults.Success;
}
Tôi có thể giải quyết nó như thế nào?
đâu mã của bạn –
Bạn có thể chỉ tham chiếu System.IO.Compression, lạ đủ, bạn cần phải tham khảo System.IO.Compression.FileSystem quá? –