Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaitanya Donthini committed May 24, 2019
2 parents 7950612 + cfdda34 commit 6dd1548
Show file tree
Hide file tree
Showing 21 changed files with 255 additions and 90 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions AppInstallerFileBuilder/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# AppInstaller File Builder

AppInstaller File Builder is a Windows 10 applications for users to easily build an AppInstaller file. Currently the process of building an AppInstaller file can be error ridden. The app makes this easier by allowing the users to specify the app packages that they would like to distribute, along with the update options.

## Install the app

[Click here](https://github.com/microsoft/MSIX-Toolkit/releases/download/v1.0/AppInstallerFileBuilder-Release.appx) to download the app package and use App Installer to install it:
![install app](AppInstallerFileBuilder-appinstaller.png)

## Use

**Step 1:** Install and launch the app

**Step 2:** Browse to the app package that you would like to install using the AppInstaller file
![App Home](AppInstallerFileBuilder.png)

**Step 3:** Specify the update options that you would like the app package to have

**Step 4:** Follow the flow to add optional packages, modification packages or framework dependencies as part of the AppInstaller file

**Step 5:** At any time, you can click on ***Review*** to view the current state of the AppInstaller file and if you are satisfied with it, click on ***Generate*** to generate the AppInstaller file.

## Contribute

This is an open source app project. We welcome any contributions to the app whether it be suggestions or PR's.
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
# MSIX Toolkit

MSIX Toolkit is a combination of tools and scripts focused on assisting IT pros and developers to make their app package modernization journey smoother. The toolkit will be open sourced on GitHub to allow customers and enthusiasts to contribute directly and provide suggestions and feedback on the content that is available.
The goal of the toolkit is to make it a gathering place for customers working with MSIX packages to come and find the help and assistance they need to build, manage, troubleshoot them.

## Principles:
1. MSIX toolkit is a community led space where customers can freely contribute source code along with binaries and executables
2. Users can’t post artifacts that don’t have a corresponding source code unless they are redistributables (discussed in more detail later in the doc).
3. Till enough community involvement, a Microsoft employee will oversee making the decision to accept a pull request into the GitHub master branch.
4. All contributed source code will need to include a readme file with detailed instructions on the setup and how to build the source code

## Posting source code:
Source code in the master branch will need to adhere to the following guidelines:
- The source code needs to compile
- The source code needs to compile into consumable binaries or executables with an entrypoint
- The code quality will need to adhere to common coding standards
- Microsoft curator will provide the feedback to contributors on any pull request on the changes that are required to accept their contribution

## Posting consumable binaries or executables:
- Contributors are encouraged to also add the built binaries, so that users can directly consume them as compared to requiring them to compile the source code.
- By having access to the source code along with the built binaries, users can validate their scenarios and if they are not met – they can contribute back to the source code to add support for their scenarios.

## How to contribute:
MSIX toolkit GitHub repository will accept external contributions via pull requests from a fork.

This article goes through the process of what an external contributor will need to go through to create a pull request - https://help.github.com/en/articles/creating-a-pull-request-from-a-fork

Before we can accept a pull request from you, you'll need to sign a Contributor License Agreement (CLA). It is an automated process and you only need to do it once.

To enable us to quickly review and accept your pull requests, always create one pull request per issue. Similarly, if it’s a new tool or script, create individual pull requests per tool or script. Keep the pull requests as small and contained to a scenario as possible.

Never merge multiple requests in one unless they have the same root cause. Avoid pure formatting changes to code that has not been modified otherwise. Pull requests should contain tests or readme material to explain the changes and how it can be used whenever possible.

## Source code guidelines:
It is important to make sure that sound coding practices are enforced initially in the setup of the MSIX Toolkit GitHub project. To that end, all contributions from internal and external contributions will need to be reviewed by fellow colleagues before the code can be checked in.

We will have a few folks that will manage the GitHub project that will act as the mandatory reviewers for source code that will be checked in.

## License:
The goal of this project is to enable our customers to be more productive and efficient while working with MSIX packages. The license for this project will allow people to freely use the source code and tools.

All the source code in the MSIX-Toolkit GitHub project will accompany with an open license which means users are allowed to use as-is or modify the code as needed for their purposes.

Only source code that is in the master branch of MSIX toolkit repo will be built on each pull request merge.

## Executable code:
The build system will build only win32 applications and MSIX packages and copy the artifacts to the releases tab for consumption.
Speak with William on how to setup the build system for MSIX packages in a GitHub repo.

## Scripts:
There will no build systems for scripts. Scripts will be checked in as source code and will be available for download. Scripts will be formatted and commented prior to being checked in to master.

## Tests:
Always recommended. Including tests in your pull requests will help expedite the review process as it allows contributors and reviewers ways to validate. It is also good practice to ensure that the source code builds and compile fine.

We also understand that it might not always make sense to have test case for your pull requests. Besides pull requests that are fixing a minor issue, we ask that the pull request includes an addition to the readme file that will detail the new functionality that was added and how it can be used.

## What to upload in a project:
Only upload the files and content that is required to compile the application. For instance, if you are using Visual Studio as your IDE, VS auto-generates a bunch of files that are using specific to the setup of the local user which aren’t applicable or required. So we recommend that you add these files to the .gitignore file.

## Redistributables:
MSIX Toolkit will also include tools that are traditionally available in the Windows 10 SDK. This allows for IT pros specifically to not require downloading a massive SDK that is of no use to them. There is a ‘redist’ folder in the root of the MSIX toolkit GitHub project where these tools will be available.

## Contributing

Expand Down
Binary file added Redist/AppxPackaging.dll
Binary file not shown.
Binary file added Redist/AppxPackaging.dll.mui
Binary file not shown.
Binary file added Redist/AppxSip.dll
Binary file not shown.
Binary file added Redist/MakeAppx.exe
Binary file not shown.
Binary file added Redist/MakePri.exe
Binary file not shown.
52 changes: 52 additions & 0 deletions Redist/Microsoft.Windows.Build.Appx.AppxPackaging.dll.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<assemblyIdentity
name="Microsoft.Windows.Build.Appx.AppxPackaging.dll"
version="0.0.0.0"/>

<file name="AppxPackaging.dll">
<comClass
clsid="{5842a140-ff9f-4166-8f5c-62f5b7b0c781}"
threadingModel="Both"
description="AppxFactory class"/>
<comClass
clsid="{DC664FDD-D868-46EE-8780-8D196CB739F7}"
threadingModel="Both"
description="AppxEncryptionFactory class"/>
<comClass
clsid="{378E0446-5384-43B7-8877-E7DBDD883446}"
threadingModel="Both"
description="AppxBundleFactory class"/>
<comClass
clsid="{48DE828C-730C-49AF-AE84-759C609911EE}"
threadingModel="Both"
description="AppxNoValidationFactory class"/>
<comClass
clsid="{F004F2CA-AEBC-4B0D-BF58-E516D5BCC0AB}"
threadingModel="Both"
description="AppxPackageEditor class"/>
<comClass
clsid="{7F00FA1E-9820-47B1-9C4F-8701F1432177}"
threadingModel="Both"
description="AppxPackagingLayoutReader class"/>
<comClass
clsid="{0CF07551-EEF2-420C-B5AB-7E4FEB2249CF}"
threadingModel="Both"
description="AppxFactoryInternal class"/>
<comClass
clsid="{50CA0A46-1588-4161-8ED2-EF9E469CED5D}"
threadingModel="Both"
description="AppxPackagingDiagnosticEventSinkManager class"/>
</file>

<dependency>
<dependentAssembly>
<assemblyIdentity
name="Microsoft.Windows.Build.Appx.OpcServices.dll"
version="0.0.0.0"/>
</dependentAssembly>
</dependency>

</assembly>
19 changes: 19 additions & 0 deletions Redist/Microsoft.Windows.Build.Appx.AppxSip.dll.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<assemblyIdentity
name="Microsoft.Windows.Build.Appx.AppxSip.dll"
version="0.0.0.0"/>

<file name="AppxSip.dll"/>

<dependency>
<dependentAssembly>
<assemblyIdentity
name="Microsoft.Windows.Build.Appx.AppxPackaging.dll"
version="0.0.0.0"/>
</dependentAssembly>
</dependency>

</assembly>
16 changes: 16 additions & 0 deletions Redist/Microsoft.Windows.Build.Appx.OpcServices.dll.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<assemblyIdentity
name="Microsoft.Windows.Build.Appx.OpcServices.dll"
version="0.0.0.0"/>

<file name="OpcServices.dll">
<comClass
clsid="{6B2D6BA0-9F3E-4f27-920B-313CC426A39E}"
threadingModel="Both"
description="OpcFactory class"/>
</file>

</assembly>
Binary file added Redist/OpcServices.dll
Binary file not shown.
10 changes: 10 additions & 0 deletions Scripts/BatchConversion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
A set of basic scripts that allow converting a batch of installers on a set of machines using MSIX Packaging Tool:

Supporting scripts:
1. batch_convert.ps1 - Dispatch work to target machines
2. sign_deploy_run.ps1 - Sign resulting packages
3. run_job.ps1 - Attempt to run the packages locally for initial validation

Usage:
Edit the file entry.ps1 with the parameters of your virtual/remote machines and installers you would like to convert.
Run: entry.ps1
6 changes: 0 additions & 6 deletions Scripts/BatchConversion/Readme.txt

This file was deleted.

68 changes: 34 additions & 34 deletions Scripts/BatchConversion/batch_convert.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,47 +62,47 @@ function RunConversionJobs($conversionsParameters, $virtualMachines, $remoteMach

# Next schedule jobs on virtual machines which can be checkpointed/re-used
# keep a mapping of VMs and the current job they're running, initialized ot null
# $vmsCurrentJobMap = @{}
# $virtualMachines | Foreach-Object { $vmsCurrentJobMap.Add($_.Name, $nul) }
$vmsCurrentJobMap = @{}
$virtualMachines | Foreach-Object { $vmsCurrentJobMap.Add($_.Name, $nul) }

# # Use a semaphore to signal when a machine is available. Note we need a global semaphore as the jobs are each started in a different powershell process
# $semaphore = New-Object -TypeName System.Threading.Semaphore -ArgumentList @($virtualMachines.Count, $virtualMachines.Count, "Global\MPTBatchConversion")
# Use a semaphore to signal when a machine is available. Note we need a global semaphore as the jobs are each started in a different powershell process
$semaphore = New-Object -TypeName System.Threading.Semaphore -ArgumentList @($virtualMachines.Count, $virtualMachines.Count, "Global\MPTBatchConversion")

# while ($semaphore.WaitOne(-1))
# {
# if ($remainingConversions.Count -gt 0)
# {
# # select a job to run
# Write-Host "Determining next job to run..."
# $conversionParam = $conversionsParameters[$remainingConversions[0]]
# # select a VM to run it on. Retry a few times due to race between semaphore signaling and process completion status
# $vm = $nul
# while (-not $vm) { $vm = $virtualMachines | where { -not($vmsCurrentJobMap[$_.Name]) -or -not($vmsCurrentJobMap[$_.Name].ExitCode -eq $Nul) } | Select-Object -First 1 }
# Write-Host "Dequeuing conversion job for installer $($conversionParam.InstallerPath) on VM $($vm.Name)"
while ($semaphore.WaitOne(-1))
{
if ($remainingConversions.Count -gt 0)
{
# select a job to run
Write-Host "Determining next job to run..."
$conversionParam = $conversionsParameters[$remainingConversions[0]]
# select a VM to run it on. Retry a few times due to race between semaphore signaling and process completion status
$vm = $nul
while (-not $vm) { $vm = $virtualMachines | where { -not($vmsCurrentJobMap[$_.Name]) -or -not($vmsCurrentJobMap[$_.Name].ExitCode -eq $Nul) } | Select-Object -First 1 }
Write-Host "Dequeuing conversion job for installer $($conversionParam.InstallerPath) on VM $($vm.Name)"

# # Capture the job index and update list of remaining conversions to run
# $jobId = $remainingConversions[0]
# $remainingConversions = $remainingConversions | where { $_ -ne $remainingConversions[0] }
# Capture the job index and update list of remaining conversions to run
$jobId = $remainingConversions[0]
$remainingConversions = $remainingConversions | where { $_ -ne $remainingConversions[0] }

# $templateFilePath = CreateMPTTemplate $conversionParam $jobId $vm $nul $workingDirectory
# $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($vm.Credential.Password)
# $password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
$templateFilePath = CreateMPTTemplate $conversionParam $jobId $vm $nul $workingDirectory
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($vm.Credential.Password)
$password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)

# $process = Start-Process "powershell.exe" -ArgumentList($runJobScriptPath, "-jobId", $jobId, "-vmName", $vm.Name, "-vmsCount", $virtualMachines.Count, "-machinePassword", $password, "-templateFilePath", $templateFilePath, "-initialSnapshotName", $initialSnapshotName) -PassThru
# $vmsCurrentJobMap[$vm.Name] = $process
# }
# else
# {
# $semaphore.Release()
# break;
# }
$process = Start-Process "powershell.exe" -ArgumentList($runJobScriptPath, "-jobId", $jobId, "-vmName", $vm.Name, "-vmsCount", $virtualMachines.Count, "-machinePassword", $password, "-templateFilePath", $templateFilePath, "-initialSnapshotName", $initialSnapshotName) -PassThru
$vmsCurrentJobMap[$vm.Name] = $process
}
else
{
$semaphore.Release()
break;
}

# Sleep(1)
# }
Sleep(1)
}

#Write-Host "Finished scheduling all jobs"
#$virtualMachines | foreach-object { if ($vmsCurrentJobMap[$_.Name]) { $vmsCurrentJobMap[$_.Name].WaitForExit() } }
#$semaphore.Dispose()
Write-Host "Finished scheduling all jobs"
$virtualMachines | foreach-object { if ($vmsCurrentJobMap[$_.Name]) { $vmsCurrentJobMap[$_.Name].WaitForExit() } }
$semaphore.Dispose()
Read-Host -Prompt 'Press any key to continue '
Write-Host "Finished running all jobs"
}
40 changes: 20 additions & 20 deletions Scripts/BatchConversion/entry.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
$credential = Get-Credential

$virtualMachines = @(
# @{ Name = "vm1"; Credential = $credential }
# @{ Name = "vm2"; Credential = $credential }
@{ Name = "vm1"; Credential = $credential }
@{ Name = "vm2"; Credential = $credential }
)

$remoteMachines = @(
# @{ ComputerName = "YourVMNameHere.westus.cloudapp.azure.com"; Credential = $credential }
@{ ComputerName = "YourVMNameHere.westus.cloudapp.azure.com"; Credential = $credential }
)

$conversionsParameters = @(
Expand All @@ -23,23 +23,23 @@ $conversionsParameters = @(
PublisherName = "CN=YourCompany";
PublisherDisplayName = "YourCompany";
PackageVersion = "1.0.0.0"
}#,
#@{
# InstallerPath = "Path\To\Your\Installer\YourInstaller2.msi";
# PackageName = "YourApp2";
# PackageDisplayName = "Your App2";
# PublisherName = "CN=YourCompany";
# PublisherDisplayName = "YourCompany";
# PackageVersion = "1.0.0.0"
#},
#@{
# InstallerPath = "Path\To\Your\Installer\YourInstaller3.msi";
# PackageName = "YourApp3";
# PackageDisplayName = "Your App3";
# PublisherName = "CN=YourCompany";
# PublisherDisplayName = "YourCompany";
# PackageVersion = "1.0.0.0"
#}
},
@{
InstallerPath = "Path\To\Your\Installer\YourInstaller2.msi";
PackageName = "YourApp2";
PackageDisplayName = "Your App2";
PublisherName = "CN=YourCompany";
PublisherDisplayName = "YourCompany";
PackageVersion = "1.0.0.0"
},
@{
InstallerPath = "Path\To\Your\Installer\YourInstaller3.msi";
PackageName = "YourApp3";
PackageDisplayName = "Your App3";
PublisherName = "CN=YourCompany";
PublisherDisplayName = "YourCompany";
PackageVersion = "1.0.0.0"
}
)

$workingDirectory = [System.IO.Path]::Combine($PSScriptRoot, "out")
Expand Down
3 changes: 0 additions & 3 deletions Scripts/BatchConversion/sign_deploy_run.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
function SignAndDeploy($msixFolder)
{
Get-AppxPackage *YourApp* | Remove-AppxPackage
Get-AppxPackage *YourApp2* | Remove-AppxPackage
Get-AppxPackage *YourApp3* | Remove-AppxPackage

Get-ChildItem $msixFolder | foreach-object {
$pfxFilePath = "\\Path\To\Your\Certificate\YourCert.pfx"
Expand Down
4 changes: 2 additions & 2 deletions Scripts/ModifyPackagePublisher/modify-package-publisher.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ param(


#relative paths to the tools used to repackage and sign
$packageEditorExe = "packageeditor\PackageEditor.exe"
$signToolExe = "SDK_Signing_Tools\signtool.exe"
$packageEditorExe = "PackageEditor.exe"
$signToolExe = "signtool.exe"

#retreive publisher info from the .cer file
function GetCertPublisher
Expand Down
Loading

0 comments on commit 6dd1548

Please sign in to comment.