iT邦幫忙

1

Visual Studio連線MySQL問題_解決辦法

問題描述:

使用Visual Studio連線MySQL出現報錯
錯誤訊息如下
「System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. 系統找不到指定的檔案。'」

https://ithelp.ithome.com.tw/upload/images/20210726/201398850EZHwXbLYg.png

已經正確引入MySQL.Data.dll檔案,不過仍未能執行。
https://ithelp.ithome.com.tw/upload/images/20210726/20139885KYj6n9NdAR.png

解決辦法:

錯誤訊息為「無法找到System.Security.Permissions的檔案」,因此使用Nuget下載缺少的檔案。
使用「工具」> 「NuGet套件管理員」 > 「案件管理主控台」
https://ithelp.ithome.com.tw/upload/images/20210726/20139885McHaNwVvYw.png

在下方「套件管理主控台」,輸入
Install-Package System.Security.Permissions -Version 6.0.0-preview.6.21352.12

https://ithelp.ithome.com.tw/upload/images/20210726/20139885yKFGwuv7ZR.png

輸入內容可參考
https://www.nuget.org/packages/System.Security.Permissions/6.0.0-preview.6.21352.12

將需下載檔案輸入搜尋即可複製要輸入的code
https://ithelp.ithome.com.tw/upload/images/20210726/201398857B3JWDOpM8.png

Visual Studio下載完成後,依個人經驗會再出現幾個類似報錯,
再依照同樣方式處理後,直到缺少的檔案都下載後就可以正常執行MySQL了。


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言