我有一些最初使用Visual Studio 2012用VB编写的VB代码,我尝试将它们更新到Visual Studio 2017 VB。到目前为止,除语句“使用zip1作为ZipFile = New ZipFile”中的一个错误提示外,我已经能够解决所有转换错误。
我收到的错误是“未定义BC30002类型'ZipFile'”。
这是我的代码:
Private Sub DoSave(ByVal sender As Object, ByVal e As DoWorkEventArgs)
Dim options As WorkerOptions = e.Argument
Try
Using zip1 As ZipFile = New ZipFile
For Each sFile2Backup As String In sFilesToBackup
zip1.AddFile(options.Folder & sFile2Backup, "\")
Next
For Each sFolder2Backup As String In sFoldersToBackup
zip1.AddDirectory(options.Folder & sFolder2Backup, "\" & sFolder2Backup)
Next
Me._entriesToZip = zip1.EntryFileNames.Count
Me.SetProgressBars()
AddHandler zip1.SaveProgress, New EventHandler(Of SaveProgressEventArgs)(AddressOf Me.zip1_SaveProgress)
zip1.Save(options.ZipName)
End Using
Catch exc1 As Exception
MessageBox.Show(String.Format("Exception while zipping: {0}", exc1.Message))
Me.Button_Cancel_Click(Nothing, Nothing)
End Try
End Sub ' **** END Private Sub DoSave()
我已经尝试了Visual Studio 2017提供的每个“显示潜在修复程序”,但这只会增加报告的错误数量。
我是一名“休闲”编码员,所以这个问题让我感到很困惑,而Google博士没有提出切实可行的建议,因此,任何建议/解决方案都将不胜感激。