我使用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 :(得分:0)
问题证明是在升级库之后,项目中的引用将其特定版本属性切换为false。这导致Visual Studio无法正确引用库的正确版本。
故事的道德,确保检查您的版本,如果您需要使用特定版本,您的特定版本检查是真的!