Add clickonce (#252)
* add project * Simple detection that it's from http, then simply download the file first before. This is the simplest hack to get a working prototype, larger files will incur significant delay before being able to show packageInfo in the UX. * fix win10 redirect code too. * update pre-build task to auto-copy built versions of exe and dll
This commit is contained in:
Родитель
998c3fa144
Коммит
a23cc31e3b
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
|
@ -0,0 +1,79 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Deployment.Application;
|
||||
using System.Collections.Specialized;
|
||||
using System.Web;
|
||||
|
||||
namespace ClickOnceWrapper
|
||||
{
|
||||
static class ClickOnceWrapper
|
||||
{
|
||||
static bool IsRS3OrAbove()
|
||||
{
|
||||
Version osVersion = Environment.OSVersion.Version;
|
||||
if (osVersion.Major >= 10 &&
|
||||
osVersion.Build >= 16299)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The functionality of this ClickOnce Wrapper is to wrap the msixmgr.exe and msix.dll installer binaries.
|
||||
/// This ClickOnce app is intended to be hosted on a website, and be passed in a URL to an .msix package
|
||||
/// This app will then install that .msix package.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
NameValueCollection col = new NameValueCollection();
|
||||
|
||||
if (ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.ActivationUri != null)
|
||||
{
|
||||
string queryString = ApplicationDeployment.CurrentDeployment.ActivationUri.Query;
|
||||
col = HttpUtility.ParseQueryString(queryString);
|
||||
|
||||
string decode = HttpUtility.UrlDecode(col.ToString());
|
||||
|
||||
System.Diagnostics.ProcessStartInfo processInfo;
|
||||
if (IsRS3OrAbove())
|
||||
{
|
||||
// re-route directly to desktop app installer
|
||||
string desktopAppInstallerProtocol = "ms-appinstaller:?source=" + decode;
|
||||
processInfo = new System.Diagnostics.ProcessStartInfo(desktopAppInstallerProtocol);
|
||||
}
|
||||
else
|
||||
{
|
||||
string arguments = "-addpackage " + decode;
|
||||
// It is not possible to launch a ClickOnce app as administrator directly,
|
||||
// so instead we launch the app as administrator in a new process.
|
||||
processInfo = new System.Diagnostics.ProcessStartInfo("msixmgr.exe", arguments);
|
||||
|
||||
// The following properties run the new process as administrator
|
||||
processInfo.UseShellExecute = true;
|
||||
processInfo.Verb = "runas";
|
||||
}
|
||||
|
||||
// Start the new process
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Process.Start(processInfo);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show("Unable to start this program");
|
||||
}
|
||||
|
||||
// Shut down the current process
|
||||
Application.Exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Unexpected launch, this clickonce app is expected to launch from http URL with extra URL arguments");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
namespace WindowsFormsApp1
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WindowsFormsApp1
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("WindowsFormsApp1")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("WindowsFormsApp1")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("15ffe029-61a1-41dd-8a37-7c83eb0b1a38")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,63 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace msixmgrWrapper.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("msixmgrWrapper.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -0,0 +1,26 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace msixmgrWrapper.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
|
@ -0,0 +1,70 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC Manifest Options
|
||||
If you want to change the Windows User Account Control level replace the
|
||||
requestedExecutionLevel node with one of the following.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Specifying requestedExecutionLevel element will disable file and registry virtualization.
|
||||
Remove this element if your application requires this virtualization for backwards
|
||||
compatibility.
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
<applicationRequestMinimum>
|
||||
<PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
|
||||
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||
</applicationRequestMinimum>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on
|
||||
and is designed to work with. Uncomment the appropriate elements
|
||||
and Windows will automatically select the most compatible environment. -->
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
|
||||
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
|
||||
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
|
||||
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
</assembly>
|
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -0,0 +1,188 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>msixmgrWrapper</RootNamespace>
|
||||
<AssemblyName>msixmgrWrapper</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<InstallUrl>https://appinstallerdemo.azurewebsites.net/MSIXCore/</InstallUrl>
|
||||
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
|
||||
<TrustUrlParameters>true</TrustUrlParameters>
|
||||
<ApplicationRevision>4</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>ClickOnceWrapper.ClickOnceWrapper</StartupObject>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>06A49B3AA3759805C0B0C9A8CDD0D0069254B07E</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>msixmgrClickOnceWrapper_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>true</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ClickOnceWrapper.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="msixmgrClickOnceWrapper_TemporaryKey.pfx" />
|
||||
<None Include="Properties\app.manifest" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="msix.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="msixmgr.exe">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>copy $(SolutionDir)\$(PlatformName)\$(ConfigurationName)\msix.dll $(ProjectDir)
|
||||
copy $(SolutionDir)\$(PlatformName)\$(ConfigurationName)\msixmgr.exe $(ProjectDir)</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -15,51 +15,81 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||
EndProjectSection
|
||||
EndProject
|
||||
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MsixMgrWix", "MsixMgrWix\MsixMgrWix.wixproj", "{CE395DC5-A1D0-4A35-8699-FC57A84CCF48}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{048748AB-B84C-4CEC-A468-3F6914953A3D} = {048748AB-B84C-4CEC-A468-3F6914953A3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetMsixmgrProducts", "GetMsixmgrProductsCA\GetMsixmgrProducts.csproj", "{048748AB-B84C-4CEC-A468-3F6914953A3D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "msixmgrClickOnceWrapper", "ClickOnceWrapper\msixmgrClickOnceWrapper.csproj", "{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025} = {AAD31763-5E65-47FD-958A-08E35AB83025}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Debug|x64.Build.0 = Debug|x64
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Debug|x86.Build.0 = Debug|Win32
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Debug|x86.Deploy.0 = Debug|Win32
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Release|x64.ActiveCfg = Release|x64
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Release|x64.Build.0 = Release|x64
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Release|x64.Deploy.0 = Release|x64
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Release|x86.ActiveCfg = Release|Win32
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Release|x86.Build.0 = Release|Win32
|
||||
{AAD31763-5E65-47FD-958A-08E35AB83025}.Release|x86.Deploy.0 = Release|Win32
|
||||
{46BE19BD-72E0-4452-9919-33A1F8A5F064}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{46BE19BD-72E0-4452-9919-33A1F8A5F064}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{46BE19BD-72E0-4452-9919-33A1F8A5F064}.Debug|x64.Build.0 = Debug|x64
|
||||
{46BE19BD-72E0-4452-9919-33A1F8A5F064}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{46BE19BD-72E0-4452-9919-33A1F8A5F064}.Debug|x86.Build.0 = Debug|Win32
|
||||
{46BE19BD-72E0-4452-9919-33A1F8A5F064}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{46BE19BD-72E0-4452-9919-33A1F8A5F064}.Release|x64.ActiveCfg = Release|x64
|
||||
{46BE19BD-72E0-4452-9919-33A1F8A5F064}.Release|x64.Build.0 = Release|x64
|
||||
{46BE19BD-72E0-4452-9919-33A1F8A5F064}.Release|x86.ActiveCfg = Release|Win32
|
||||
{46BE19BD-72E0-4452-9919-33A1F8A5F064}.Release|x86.Build.0 = Release|Win32
|
||||
{CE395DC5-A1D0-4A35-8699-FC57A84CCF48}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{CE395DC5-A1D0-4A35-8699-FC57A84CCF48}.Debug|x64.ActiveCfg = Debug|x86
|
||||
{CE395DC5-A1D0-4A35-8699-FC57A84CCF48}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{CE395DC5-A1D0-4A35-8699-FC57A84CCF48}.Debug|x86.Build.0 = Debug|x86
|
||||
{CE395DC5-A1D0-4A35-8699-FC57A84CCF48}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{CE395DC5-A1D0-4A35-8699-FC57A84CCF48}.Release|x64.ActiveCfg = Release|x64
|
||||
{CE395DC5-A1D0-4A35-8699-FC57A84CCF48}.Release|x64.Build.0 = Release|x64
|
||||
{CE395DC5-A1D0-4A35-8699-FC57A84CCF48}.Release|x86.ActiveCfg = Release|x86
|
||||
{CE395DC5-A1D0-4A35-8699-FC57A84CCF48}.Release|x86.Build.0 = Release|x86
|
||||
{048748AB-B84C-4CEC-A468-3F6914953A3D}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{048748AB-B84C-4CEC-A468-3F6914953A3D}.Debug|x64.ActiveCfg = Debug|x86
|
||||
{048748AB-B84C-4CEC-A468-3F6914953A3D}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{048748AB-B84C-4CEC-A468-3F6914953A3D}.Debug|x86.Build.0 = Debug|x86
|
||||
{048748AB-B84C-4CEC-A468-3F6914953A3D}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{048748AB-B84C-4CEC-A468-3F6914953A3D}.Release|x64.ActiveCfg = Release|x64
|
||||
{048748AB-B84C-4CEC-A468-3F6914953A3D}.Release|x64.Build.0 = Release|x64
|
||||
{048748AB-B84C-4CEC-A468-3F6914953A3D}.Release|x86.ActiveCfg = Release|x86
|
||||
{048748AB-B84C-4CEC-A468-3F6914953A3D}.Release|x86.Build.0 = Release|x86
|
||||
{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}.Release|x64.ActiveCfg = Release|x64
|
||||
{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}.Release|x64.Build.0 = Release|x64
|
||||
{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}.Release|x86.ActiveCfg = Release|x86
|
||||
{15FFE029-61A1-41DD-8A37-7C83EB0B1A38}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -92,16 +92,25 @@ int main(int argc, char * argv[])
|
|||
{
|
||||
TraceLoggingWrite(g_MsixUITraceLoggingProvider, "Windows10RS3 or later: redirecting to appInstaller");
|
||||
|
||||
const int bufSize = 1024;
|
||||
wchar_t path[bufSize];
|
||||
if (!GetFullPathNameW(cli.GetPackageFilePathToInstall().c_str(), bufSize, path, nullptr))
|
||||
{
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
|
||||
std::wstring protocol = std::wstring(L"ms-appinstaller:?source=");
|
||||
protocol.append(path);
|
||||
|
||||
std::wstring httpPrefix(L"http");
|
||||
bool isPathHttp = cli.GetPackageFilePathToInstall().compare(0, httpPrefix.length(), httpPrefix) == 0;
|
||||
if (isPathHttp)
|
||||
{
|
||||
protocol.append(cli.GetPackageFilePathToInstall());
|
||||
}
|
||||
else
|
||||
{
|
||||
const int bufSize = 1024;
|
||||
wchar_t path[bufSize];
|
||||
if (!GetFullPathNameW(cli.GetPackageFilePathToInstall().c_str(), bufSize, path, nullptr))
|
||||
{
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
|
||||
protocol.append(path);
|
||||
}
|
||||
ShellExecuteW(nullptr, L"Open", protocol.c_str(), nullptr, nullptr, SW_SHOWNORMAL);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
<AdditionalLibraryDirectories>..\Debug;..\..\..\.vs\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||
<AdditionalOptions>comctl32.lib %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>msixmgrlib.lib;msix.lib;msi.lib;comctl32.lib;gdiplus.lib;version.lib;taskschd.lib;windowsapp_downlevel.lib;windowsapp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>msixmgrlib.lib;msix.lib;msi.lib;comctl32.lib;gdiplus.lib;version.lib;taskschd.lib;windowsapp_downlevel.lib;windowsapp.lib;urlmon.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<DelayLoadDLLs>api-ms-win-core-winrt-string-l1-1-0.dll;api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-error-l1-1-0.dll;api-ms-win-core-winrt-error-l1-1-1.dll</DelayLoadDLLs>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
|
@ -125,7 +125,7 @@
|
|||
<AdditionalLibraryDirectories>..\x64\Debug;..\..\..\.vs\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||
<AdditionalOptions>comctl32.lib %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>msixmgrlib.lib;msix.lib;msi.lib;comctl32.lib;gdiplus.lib;version.lib;taskschd.lib;windowsapp_downlevel.lib;windowsapp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>msixmgrlib.lib;msix.lib;msi.lib;comctl32.lib;gdiplus.lib;version.lib;taskschd.lib;windowsapp_downlevel.lib;windowsapp.lib;urlmon.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<DelayLoadDLLs>api-ms-win-core-winrt-string-l1-1-0.dll;api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-error-l1-1-0.dll;api-ms-win-core-winrt-error-l1-1-1.dll</DelayLoadDLLs>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
|
@ -159,7 +159,7 @@
|
|||
<AdditionalLibraryDirectories>..\Release;..\..\..\.vs\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||
<AdditionalOptions>comctl32.lib %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>msixmgrlib.lib;msix.lib;msi.lib;comctl32.lib;gdiplus.lib;version.lib;taskschd.lib;windowsapp_downlevel.lib;windowsapp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>msixmgrlib.lib;msix.lib;msi.lib;comctl32.lib;gdiplus.lib;version.lib;taskschd.lib;windowsapp_downlevel.lib;windowsapp.lib;urlmon.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<DelayLoadDLLs>api-ms-win-core-winrt-string-l1-1-0.dll;api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-error-l1-1-0.dll;api-ms-win-core-winrt-error-l1-1-1.dll</DelayLoadDLLs>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
|
@ -189,7 +189,7 @@
|
|||
<AdditionalLibraryDirectories>..\x64\Release;..\..\..\.vs\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||
<AdditionalOptions>comctl32.lib %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>msixmgrlib.lib;msix.lib;msi.lib;comctl32.lib;gdiplus.lib;version.lib;taskschd.lib;windowsapp_downlevel.lib;windowsapp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>msixmgrlib.lib;msix.lib;msi.lib;comctl32.lib;gdiplus.lib;version.lib;taskschd.lib;windowsapp_downlevel.lib;windowsapp.lib;urlmon.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<DelayLoadDLLs>api-ms-win-core-winrt-string-l1-1-0.dll;api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-error-l1-1-0.dll;api-ms-win-core-winrt-error-l1-1-1.dll</DelayLoadDLLs>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
|
|
|
@ -32,7 +32,7 @@ shared_ptr<IMsixResponse> PackageManager::AddPackageAsync(const wstring & packag
|
|||
}
|
||||
|
||||
ComPtr<IStream> packageStream;
|
||||
if (FAILED(CreateStreamOnFileUTF16(packageFilePath.c_str(), /*forRead */ true, &packageStream)))
|
||||
if (FAILED(CreateStreamOnPackageUrl(packageFilePath.c_str(), &packageStream)))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -82,6 +82,7 @@ shared_ptr<IMsixResponse> PackageManager::AddPackageAsync(IStream * packageStrea
|
|||
return impl->GetMsixResponse();
|
||||
}
|
||||
|
||||
|
||||
HRESULT PackageManager::AddPackage(const wstring & packageFilePath, DeploymentOptions options)
|
||||
{
|
||||
if (IsWindows10RS3OrLater())
|
||||
|
@ -89,14 +90,10 @@ HRESULT PackageManager::AddPackage(const wstring & packageFilePath, DeploymentOp
|
|||
RETURN_IF_FAILED(Windows10Redirector::AddPackage(packageFilePath));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
ComPtr<IStream> packageStream;
|
||||
auto res = CreateStreamOnFileUTF16(packageFilePath.c_str(), /*forRead */ true, &packageStream);
|
||||
if (FAILED(res))
|
||||
{
|
||||
return res;
|
||||
}
|
||||
|
||||
RETURN_IF_FAILED(CreateStreamOnPackageUrl(packageFilePath, &packageStream));
|
||||
|
||||
return AddPackage(packageStream.Get(), options);
|
||||
}
|
||||
|
||||
|
@ -165,6 +162,28 @@ HRESULT PackageManager::GetPackageInfo(const wstring & directoryPath, shared_ptr
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT MsixCoreLib::PackageManager::CreateStreamOnPackageUrl(const std::wstring & package, IStream ** stream)
|
||||
{
|
||||
std::wstring httpPrefix(L"http");
|
||||
bool isPathHttp = package.compare(0, httpPrefix.length(), httpPrefix) == 0;
|
||||
if (isPathHttp)
|
||||
{
|
||||
TraceLoggingWrite(g_MsixTraceLoggingProvider,
|
||||
"HTTP file detected, will download to cache",
|
||||
TraceLoggingValue(package.c_str(), "PackageFilePath"));
|
||||
WCHAR fileName[MAX_PATH];
|
||||
RETURN_IF_FAILED(URLDownloadToCacheFile(nullptr /*activex iunknown*/, package.c_str(), fileName, MAX_PATH, 0 /*reserved*/, nullptr /*bindstatuscallback*/));
|
||||
|
||||
RETURN_IF_FAILED(CreateStreamOnFileUTF16(fileName, true /*forRead*/, stream));
|
||||
}
|
||||
else // file path
|
||||
{
|
||||
RETURN_IF_FAILED(CreateStreamOnFileUTF16(package.c_str(), true /*forRead */, stream));
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT PackageManager::FindPackage(const wstring & packageFullName, shared_ptr<IInstalledPackage>& installedPackage)
|
||||
{
|
||||
auto filemapping = FilePathMappings::GetInstance();
|
||||
|
@ -255,7 +274,7 @@ HRESULT PackageManager::GetMsixPackageInfo(const wstring & msixFullPath, shared_
|
|||
|
||||
shared_ptr<Package> packageInfo;
|
||||
ComPtr<IStream> packageStream;
|
||||
RETURN_IF_FAILED(CreateStreamOnFileUTF16(msixFullPath.c_str(), /*forRead */ true, &packageStream));
|
||||
RETURN_IF_FAILED(CreateStreamOnPackageUrl(msixFullPath.c_str(), &packageStream));
|
||||
RETURN_IF_FAILED(PopulatePackageInfo::GetPackageInfoFromPackage(packageStream.Get(), MSIX_VALIDATION_OPTION::MSIX_VALIDATION_OPTION_FULL, &packageInfo));
|
||||
|
||||
package = dynamic_pointer_cast<IPackage>(packageInfo);
|
||||
|
|
|
@ -21,5 +21,6 @@ namespace MsixCoreLib {
|
|||
HRESULT GetMsixPackageInfo(const std::wstring & msixFullPath, std::shared_ptr<IPackage> & package) override;
|
||||
private:
|
||||
HRESULT GetPackageInfo(const std::wstring & directoryPath, std::shared_ptr<IInstalledPackage> & installedPackage);
|
||||
HRESULT CreateStreamOnPackageUrl(const std::wstring & package, IStream** stream);
|
||||
};
|
||||
}
|
Загрузка…
Ссылка в новой задаче