2017-03-09 59 views
0

我正在使用Squirrel.Windows作爲我的應用程序的更新框架,並且我從1.4.4升級到最新版本1.5.2,並且通過NuGet升級後,UpdateManager類變得無法訪問,原因是這是保護級別。由於保護級別而無法訪問公共類

我創建了一個示例項目,並通過NuGet導入了Squirrel.Windows nuget包,並且我能夠實例化UpdateManager類的一個實例而沒有問題。 我試着清理出與Squirrel.Windows項目相關的所有NuGet包,並清理了與它相關的csproj中剩下的任何信息,再次導入包後,我仍然無法訪問該類。

namespace Our.Core 
{ 
    public class Launcher 
    {   
     public static void Main(string[] args) 
     { 
      new Launcher(args); 
     } 

     public async Task<bool> TryUpdate(string[] args) 
     { 
      try 
      { 
       using (var mgr = new UpdateManager(UpdatePath, null, null, null)) 
       { 
        Log.Information("Checking for updates"); 
        var updateInfo = await mgr.CheckForUpdate(); 
        if (updateInfo.ReleasesToApply.Any()) 
        { 
         Log.Information("Downloading updates"); 
         await mgr.DownloadReleases(updateInfo.ReleasesToApply); 
         Log.Information("Applying updates"); 
         await mgr.ApplyReleases(updateInfo); 

         return true; 
        } 
        Log.Information("No updates found."); 

        return false; 
       } 
      } 
      catch (Exception e) 
      { 
       Log.Error(e, "Error while updating"); 
       return false; 
      } 
     } 
    } 
} 

回答

0

問題原來是在升級庫之後,項目中的引用將其特定版本屬性切換爲false。這導致Visual Studio無法正確引用庫的正確版本。

道德故事,請確保檢查您的版本,並且如果您需要使用特定版本,您的特定版本檢查是真實的!

相關問題