Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retarget to .NET 4.5 #237

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/CreateReleasePackage/CreateReleasePackage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CreateReleasePackage</RootNamespace>
<AssemblyName>CreateReleasePackage</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
Expand All @@ -28,6 +28,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -38,6 +39,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -47,6 +49,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="MarkdownSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down
16 changes: 8 additions & 8 deletions src/CreateReleasePackage/app.config
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Web.XmlTransform" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
<assemblyIdentity name="Microsoft.Web.XmlTransform" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" />
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" />
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
44 changes: 18 additions & 26 deletions src/SampleUpdatingApp/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 10 additions & 14 deletions src/SampleUpdatingApp/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/SampleUpdatingApp/SampleUpdatingApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SampleUpdatingApp</RootNamespace>
<AssemblyName>SampleUpdatingApp</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -25,6 +26,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -34,6 +36,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="MarkdownSharp">
Expand Down
18 changes: 9 additions & 9 deletions src/SampleUpdatingApp/app.config
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>

<bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
<bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0"/>

</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" />
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" />
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Web.XmlTransform" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
<assemblyIdentity name="Microsoft.Web.XmlTransform" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
100 changes: 57 additions & 43 deletions src/Squirrel.Client/InstallManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public IObservable<List<string>> ExecuteInstall(string currentAssemblyDir, IPack
return updateUsingDeltas;
}

Task<List<string>> executeInstall(
async Task<List<string>> executeInstall(
string currentAssemblyDir,
IPackage bundledPackageMetadata,
bool ignoreDeltaUpdates = false,
Expand All @@ -83,7 +83,13 @@ Task<List<string>> executeInstall(
var realCopyFileProgress = new Subject<int>();
var realApplyProgress = new Subject<int>();

var eigenUpdateObs = Observable.Using(() => new UpdateManager(currentAssemblyDir, bundledPackageMetadata.Id, fxVersion, TargetRootDirectory), eigenUpdater => {
List<string> ret = null;

using (var eigenUpdater = new UpdateManager(
currentAssemblyDir,
bundledPackageMetadata.Id,
fxVersion,
TargetRootDirectory)) {
// The real update takes longer than the eigenupdate because we're
// downloading from the Internet instead of doing everything
// locally, so give it more weight
Expand All @@ -95,57 +101,65 @@ Task<List<string>> executeInstall(
.Select(x => (int) x)
.Subscribe(progress);

var updateInfoObs = eigenUpdater.CheckForUpdate(ignoreDeltaUpdates, eigenCheckProgress);

return updateInfoObs.SelectMany(updateInfo => {
log.Info("The checking of releases completed - and there was much rejoicing");
var updateInfo = await eigenUpdater.CheckForUpdate(ignoreDeltaUpdates, eigenCheckProgress);

if (!updateInfo.ReleasesToApply.Any()) {
log.Info("The checking of releases completed - and there was much rejoicing");

var rootDirectory = TargetRootDirectory ?? Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
if (!updateInfo.ReleasesToApply.Any()) {

var version = updateInfo.CurrentlyInstalledVersion;
var releaseFolder = String.Format("app-{0}", version.Version);
var absoluteFolder = Path.Combine(rootDirectory, version.PackageName, releaseFolder);
var rootDirectory = TargetRootDirectory ?? Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

if (!Directory.Exists(absoluteFolder)) {
log.Warn("executeInstall: the directory {0} doesn't exist - cannot find the current app?!!?");
} else {
return Observable.Return(
Directory.GetFiles(absoluteFolder, "*.exe", SearchOption.TopDirectoryOnly).ToList());
}
}
var version = updateInfo.CurrentlyInstalledVersion;
var releaseFolder = String.Format("app-{0}", version.Version);
var absoluteFolder = Path.Combine(rootDirectory, version.PackageName, releaseFolder);

foreach (var u in updateInfo.ReleasesToApply) {
log.Info("HEY! We should be applying update {0}", u.Filename);
if (!Directory.Exists(absoluteFolder)) {
log.Warn("executeInstall: the directory {0} doesn't exist - cannot find the current app?!!?");
} else {
return Directory.GetFiles(absoluteFolder, "*.exe", SearchOption.TopDirectoryOnly)
.ToList();
}
}

return eigenUpdater.DownloadReleases(updateInfo.ReleasesToApply, eigenCopyFileProgress)
.Do(_ => log.Info("The downloading of releases completed - and there was much rejoicing"))
.SelectMany(_ => eigenUpdater.ApplyReleases(updateInfo, eigenApplyProgress))
.Do(_ => log.Info("The applying of releases completed - and there was much rejoicing"));
});
});

return eigenUpdateObs.SelectMany(ret => {
var updateUrl = bundledPackageMetadata.ProjectUrl != null ? bundledPackageMetadata.ProjectUrl.ToString() : null;
updateUrl = null; //XXX REMOVE ME
if (updateUrl == null) {
realCheckProgress.OnNext(100); realCheckProgress.OnCompleted();
realCopyFileProgress.OnNext(100); realCopyFileProgress.OnCompleted();
realApplyProgress.OnNext(100); realApplyProgress.OnCompleted();
foreach (var u in updateInfo.ReleasesToApply) {
log.Info("HEY! We should be applying update {0}", u.Filename);
}

return Observable.Return(ret);
await eigenUpdater.DownloadReleases(updateInfo.ReleasesToApply, eigenCopyFileProgress);

log.Info("The downloading of releases completed - and there was much rejoicing");

ret = await eigenUpdater.ApplyReleases(updateInfo, eigenApplyProgress);

log.Info("The applying of releases completed - and there was much rejoicing");
}

var updateUrl = bundledPackageMetadata.ProjectUrl != null ? bundledPackageMetadata.ProjectUrl.ToString() : null;
updateUrl = null; //XXX REMOVE ME
if (updateUrl == null) {
realCheckProgress.OnNext(100); realCheckProgress.OnCompleted();
realCopyFileProgress.OnNext(100); realCopyFileProgress.OnCompleted();
realApplyProgress.OnNext(100); realApplyProgress.OnCompleted();

return ret;
}

using(var realUpdater = new UpdateManager(
updateUrl,
bundledPackageMetadata.Id,
fxVersion,
TargetRootDirectory)) {
try {
var updateInfo = await realUpdater.CheckForUpdate(progress: realCheckProgress);
await realUpdater.DownloadReleases(updateInfo.ReleasesToApply, realCopyFileProgress);
await realUpdater.ApplyReleases(updateInfo, realApplyProgress);
} catch (Exception ex) {
log.ErrorException("Failed to update to latest remote version", ex);
return new List<string>();
}
}

return Observable.Using(() => new UpdateManager(updateUrl, bundledPackageMetadata.Id, fxVersion, TargetRootDirectory), realUpdater => {
return realUpdater.CheckForUpdate(progress: realCheckProgress)
.SelectMany(x => realUpdater.DownloadReleases(x.ReleasesToApply, realCopyFileProgress).Select(_ => x))
.SelectMany(x => realUpdater.ApplyReleases(x, realApplyProgress))
.Select(_ => ret)
.LoggedCatch(this, Observable.Return(new List<string>()), "Failed to update to latest remote version");
});
}).ToTask();
return ret;
}

public IObservable<Unit> ExecuteUninstall(Version version = null)
Expand Down
Loading