10 Commits

Author SHA1 Message Date
Tommy Parnell
26235b3ab4 Merge pull request #1 from TerribleDev/enable64bits
enable 64 bits
2017-04-04 10:36:09 -04:00
Tommy Parnell
eb76fa5db6 enable 64 bits 2017-04-04 10:03:39 -04:00
Tommy Parnell
561fba7d62 fix certpath issues 2017-03-01 10:14:17 -05:00
Tommy Parnell
fe71454e65 fix readme 2017-03-01 07:29:49 -05:00
Tommy Parnell
4353bddafe fix assm version and nuspec version 2017-03-01 06:32:03 -05:00
Tommy Parnell
0f7afe2ebc fix up 2017-02-28 09:32:30 -05:00
Tommy Parnell
ef913ecc11 stopping for now 2017-02-27 15:08:03 -05:00
Tommy Parnell
c3d74e0202 stopping for now 2017-02-18 23:34:27 -05:00
Tommy Parnell
2650fce4e1 stopping 2017-02-18 22:05:12 -05:00
Tommy Parnell
f606b596a9 stopping for now 2017-02-09 00:34:12 -05:00
13 changed files with 158 additions and 156 deletions

2
.gitignore vendored
View File

@@ -9,7 +9,7 @@
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
*.pem
# Build results
[Dd]ebug/
[Dd]ebugPublic/

View File

@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuikPak", "QuikPak\QuikPak.csproj", "{906448E0-73EA-4283-BAB1-4C81EEFC4EFA}"
EndProject
@@ -9,7 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
build.cmd = build.cmd
config.json = config.json
QuikPak\choco\quikpak.nuspec = QuikPak\choco\quikpak.nuspec
Readme.md = Readme.md
EndProjectSection

View File

@@ -1,4 +1,6 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using WixSharp;
namespace QuikPak
{
@@ -15,6 +17,8 @@ namespace QuikPak
public int IdleTimeout { get; set; } = 0;
public string ManagedPipelineMode { get; set; } = "Integrated";
public string ManagedRuntimeVersion { get; set; } = "v4.0";
public bool Enable64Bits { get; set; } = false;
public IEnumerable<Cert> Certificates { get; set; }
}
public class Endpoint
@@ -23,4 +27,14 @@ namespace QuikPak
public string DnsName { get; set; }
public bool Secure { get; set; } = false;
}
}
public class Cert
{
public string Name { get; set; }
public string Path { get; set; }
public string Password { get; set; }
[JsonIgnore]
public Binary BinaryKey { get; set; }
}
}

View File

@@ -1,12 +1,17 @@
{
"UpgradeCode": "317e4313-2314-46e9-ae7e-6cdfee60c05d",
"Name": "MyWebsite",
"Version": "1.0.0.0",
"Endpoints": [
{
"port": 80,
"DnsName": "*",
"Secure": false
}
]
}
"UpgradeCode": "317e4313-2314-46e9-ae7e-6cdfee60c05d",
"Name": "terribledev",
"Version": "1.0.0.1",
"Endpoints": [
{
"port": 10000,
"DnsName": "*",
"Secure": false
},
{
"port": 8000,
"DnsName": "localhost",
"Secure" : false
}
]
}

View File

@@ -18,4 +18,4 @@ namespace QuikPak
return HelpText.AutoBuild(this);
}
}
}
}

View File

@@ -3,6 +3,9 @@ using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using WixSharp;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
namespace QuikPak
{
@@ -40,12 +43,11 @@ namespace QuikPak
Attributes = attr
});
}
var project = new Project(config.Name)
{
Dirs = new[]
{
new Dir(new Id("IISMain"), config.Name + "_" +config.Version.ToString() +"_Web",
new Dir(new Id("IISMain"), config.Name + "_" +config.Version +"_Web",
new Files(System.IO.Path.Combine(options.Path, "**")),
new File(options.Config,
@@ -54,7 +56,7 @@ namespace QuikPak
Name = config.Name + "_Web_VDIR",
WebSite = new WebSite(config.Name)
{
InstallWebSite = false,
InstallWebSite = true,
Description = config.Name,
Addresses = addresses.ToArray()
},
@@ -69,14 +71,24 @@ namespace QuikPak
}
})
)
},
},
Version = new Version(config.Version) { },
GUID = string.IsNullOrWhiteSpace(config.Id) ? Guid.NewGuid() : new Guid(config.Id),
UI = WUI.WixUI_ProgressOnly,
OutFileName = config.Name,
PreserveTempFiles = true,
Binaries = config.Certificates?.Select(a=> {
var bin = new Binary(a.Path);
a.BinaryKey = bin;
return bin;
}).ToArray() ?? new Binary[0],
UpgradeCode = new Guid(config.UpgradeCode),
Certificates = config.Certificates?.Select(a => new Certificate() { PFXPassword = a.Password, BinaryKey = a.BinaryKey.Id, StoreName = StoreName.personal, StoreLocation = StoreLocation.localMachine, Name = a.Name}).ToArray() ?? new Certificate[0]
};
if(config.Enable64Bits)
{
project.Platform = Platform.x64;
}
project.Properties.Add(new Property("REINSTALLMODE", "dmus"));
project.MajorUpgrade = new MajorUpgrade() { AllowDowngrades = true, Schedule = UpgradeSchedule.afterInstallInitialize };
project.MajorUpgradeStrategy = new MajorUpgradeStrategy()
@@ -90,7 +102,55 @@ namespace QuikPak
},
RemoveExistingProductAfter = Step.InstallInitialize
};
project.IncludeWixExtension(WixExtension.IIs);
Compiler.WixSourceGenerated += (document) =>
{
string appPoolId = string.Empty;
var certs = new List<XElement>();
XElement website = null;
foreach(var node in document.Descendants().ToList())
{
if(node == null || node.Name == null) continue;
var nodeName = node.Name.ToString();
if(nodeName.EndsWith("WebVirtualDir", true))
{
//remove virdir's as we should just use sites
node.Remove();
}
if(nodeName.EndsWith("WebAppPool", true))
{
appPoolId = node.Attributes().First(a => a.Name == "Id").Value;
}
if(nodeName.EndsWith("Certificate", true))
{
certs.Add(node);
}
if(nodeName.EndsWith("WebSite", true))
{
website = node;
}
}
if(string.IsNullOrWhiteSpace(appPoolId))
{
Console.Error.WriteLine("App pool unable to be identified. A major problem has occured");
Environment.Exit(1);
}
if(website == null)
{
Console.Error.WriteLine("website unable to be identified. A major problem has occured");
Environment.Exit(1);
}
XNamespace name = "http://schemas.microsoft.com/wix/IIsExtension";
foreach(var cert in certs)
{
website.Add(new XElement(name+"CertificateRef", new XAttribute("Id", cert.Attribute("Id").Value)));
}
website.Add(new XElement(name + "WebApplication", new XAttribute("Id", config.Name + "webapp"), new XAttribute("Name", config.Name + "webapp"), new XAttribute("WebAppPool", appPoolId)));
};
Compiler.BuildMsi(project);
}
}
}
}

View File

@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// 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("0.7.1.0")]
[assembly: AssemblyFileVersion("0.7.1.0")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]

View File

@@ -35,7 +35,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="BootstrapperCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ce35f76fcda82bad, processorArchitecture=MSIL">
<HintPath>..\packages\WixSharp.bin.1.0.35.3\lib\BootstrapperCore.dll</HintPath>
<HintPath>..\packages\WixSharp.bin.1.3.0.0\lib\BootstrapperCore.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL">
@@ -43,7 +43,7 @@
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Deployment.WindowsInstaller, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ce35f76fcda82bad, processorArchitecture=MSIL">
<HintPath>..\packages\WixSharp.bin.1.0.35.3\lib\Microsoft.Deployment.WindowsInstaller.dll</HintPath>
<HintPath>..\packages\WixSharp.bin.1.3.0.0\lib\Microsoft.Deployment.WindowsInstaller.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
@@ -58,16 +58,16 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WixSharp, Version=1.0.35.3, Culture=neutral, PublicKeyToken=3775edd25acc43c2, processorArchitecture=MSIL">
<HintPath>..\packages\WixSharp.bin.1.0.35.3\lib\WixSharp.dll</HintPath>
<Reference Include="WixSharp, Version=1.3.0.0, Culture=neutral, PublicKeyToken=3775edd25acc43c2, processorArchitecture=MSIL">
<HintPath>..\packages\WixSharp.bin.1.3.0.0\lib\WixSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="WixSharp.Msi, Version=1.0.35.0, Culture=neutral, PublicKeyToken=3775edd25acc43c2, processorArchitecture=MSIL">
<HintPath>..\packages\WixSharp.bin.1.0.35.3\lib\WixSharp.Msi.dll</HintPath>
<Reference Include="WixSharp.Msi, Version=1.3.0.0, Culture=neutral, PublicKeyToken=3775edd25acc43c2, processorArchitecture=MSIL">
<HintPath>..\packages\WixSharp.bin.1.3.0.0\lib\WixSharp.Msi.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="WixSharp.UI, Version=1.0.35.2, Culture=neutral, PublicKeyToken=3775edd25acc43c2, processorArchitecture=MSIL">
<HintPath>..\packages\WixSharp.bin.1.0.35.3\lib\WixSharp.UI.dll</HintPath>
<Reference Include="WixSharp.UI, Version=1.3.0.0, Culture=neutral, PublicKeyToken=3775edd25acc43c2, processorArchitecture=MSIL">
<HintPath>..\packages\WixSharp.bin.1.3.0.0\lib\WixSharp.UI.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
@@ -83,13 +83,6 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\WixSharp.1.0.35.3\build\WixSharp.targets" Condition="Exists('..\packages\WixSharp.1.0.35.3\build\WixSharp.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\WixSharp.1.0.35.3\build\WixSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WixSharp.1.0.35.3\build\WixSharp.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@@ -97,5 +90,12 @@
<Target Name="AfterBuild">
</Target>
-->
<UsingTask AssemblyFile="packages\WixSharp.1.0.35.3\build\SetEnvVar.dll" TaskName="SetEnvVar" />
<Import Project="..\packages\WixSharp.1.3.0.0\build\WixSharp.targets" Condition="Exists('..\packages\WixSharp.1.3.0.0\build\WixSharp.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\WixSharp.1.3.0.0\build\WixSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WixSharp.1.3.0.0\build\WixSharp.targets'))" />
</Target>
<UsingTask AssemblyFile="$(SolutionDir)packages\WixSharp.1.3.0.0\build\SetEnvVar.dll" TaskName="SetEnvVar" />
</Project>

View File

@@ -5,29 +5,27 @@
<!-- Read this before publishing packages to chocolatey.org: https://github.com/chocolatey/chocolatey/wiki/CreatePackages -->
<id>quikpak</id>
<title>QuikPak (Install)</title>
<version>0.7.1</version>
<version>0.9.0</version>
<authors>Tommy Parnell</authors>
<owners>Tommy Parnell</owners>
<summary>quickly pack directory's as IIS websites</summary>
<description>quickly pack directory's as IIS websites
</description>
<projectUrl>https://github.com/tparnell8/QuikPak</projectUrl>
<packageSourceUrl>https://github.com/tparnell8/QuikPak</packageSourceUrl>
<projectUrl>https://github.com/terribledev/QuikPak</projectUrl>
<packageSourceUrl>https://github.com/terribledev/QuikPak</packageSourceUrl>
<!--<projectSourceUrl></projectSourceUrl>
<docsUrl></docsUrl>
<mailingListUrl></mailingListUrl>
<bugTrackerUrl></bugTrackerUrl>-->
<tags>MSI creation IIS</tags>
<copyright></copyright>
<licenseUrl>https://github.com/tparnell8/QuikPak/blob/master/LICENSE.md</licenseUrl>
<licenseUrl>https://github.com/terribledev/QuikPak/blob/master/LICENSE.md</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<dependencies>
<dependency id="wixtoolset" />
<dependency id="wixtoolset" version="3.10.2.2516" />
</dependencies>
<!--<provides></provides>-->
</metadata>
<files>
<file src="tools\**" target="tools" />
<file src="..\bin\Release\**" target="" />
<file src="..\bin\Release\**" target="" />
</files>
</package>

View File

@@ -1,91 +0,0 @@
## Summary
How do I create packages? See https://github.com/chocolatey/choco/wiki/CreatePackages
If you are submitting packages to the community feed (https://chocolatey.org)
always try to ensure you have read, understood and adhere to the create
packages wiki link above.
## Automatic Packages?
Consider making this package an automatic package, for the best
maintainability over time. Read up at https://github.com/chocolatey/choco/wiki/AutomaticPackages
## Shim Generation
Any executables you include in the package or download (but don't call
install against using the built-in functions) will be automatically shimmed.
This means those executables will automatically be included on the path.
Shim generation runs whether the package is self-contained or uses automation
scripts.
By default, these are considered console applications.
If the application is a GUI, you should create an empty file next to the exe
named 'name.exe.gui' e.g. 'bob.exe' would need a file named 'bob.exe.gui'.
See https://github.com/chocolatey/choco/wiki/CreatePackages#how-do-i-set-up-batch-redirects-for-applications-that-have-a-gui
If you want to ignore the executable, create an empty file next to the exe
named 'name.exe.ignore' e.g. 'bob.exe' would need a file named
'bob.exe.ignore'.
See https://github.com/chocolatey/choco/wiki/CreatePackages#how-do-i-exclude-executables-from-getting-batch-redirects
## Self-Contained?
If you have a self-contained package, you can remove the automation scripts
entirely and just include the executables, they will automatically get shimmed,
which puts them on the path. Ensure you have the legal right to distribute
the application though. See https://github.com/chocolatey/choco/wiki/Legal.
You should read up on the Shim Generation section to familiarize yourself
on what to do with GUI applications and/or ignoring shims.
## Automation Scripts
You have a powerful use of Chocolatey, as you are using PowerShell. So you
can do just about anything you need. Choco has some very handy built-in
functions that you can use, these are sometimes called the helpers.
### Built-In Functions
https://github.com/chocolatey/choco/wiki/HelpersReference
A note about a couple:
* Get-BinRoot - this is a horribly named function that doesn't do what new folks think it does. It gets you the 'tools' root, which by default is set to 'c:\tools', not the chocolateyInstall bin folder.
* Install-BinFile - used for non-exe files - executables are automatically shimmed...
* Uninstall-BinFile - used for non-exe files - executables are automatically shimmed
### Getting package specific information
Use the package parameters pattern - see https://github.com/chocolatey/choco/wiki/How-To-Parse-PackageParameters-Argument
### Need to mount an ISO?
https://github.com/chocolatey/choco/wiki/How-To-Mount-An-Iso-In-Chocolatey-Package
### Environment Variables
Chocolatey makes a number of environment variables available (You can access any of these with $env:TheVariableNameBelow):
* TEMP = Overridden to the CacheLocation, but may be the same as the original TEMP folder
* ChocolateyInstall = Top level folder where Chocolatey is installed
* chocolateyPackageName = The name of the package, equivalent to the id in the nuspec (0.9.9+)
* chocolateyPackageVersion = The version of the package, equivalent to the version in the nuspec (0.9.9+)
* chocolateyPackageFolder = The top level location of the package folder
#### Advanced Environment Variables
The following are more advanced settings:
* chocolateyPackageParameters = (0.9.8.22+)
* CHOCOLATEY_VERSION = The version of Choco you normally see. Use if you are 'lighting' things up based on choco version. (0.9.9+)
- Otherwise take a dependency on the specific version you need.
* chocolateyForceX86 = If available and set to 'true', then user has requested 32bit version. (0.9.9+)
- Automatically handled in built in Choco functions.
* OS_PLATFORM = Like Windows, OSX, Linux. (0.9.9+)
* OS_VERSION = The version of OS, like 6.1 something something for Windows. (0.9.9+)
* OS_NAME = The reported name of the OS. (0.9.9+)
* IS_PROCESSELEVATED = Is the process elevated? (0.9.9+)
#### Experimental Environment Variables
The following are experimental or use not recommended:
* OS_IS64BIT = This may not return correctly - it may depend on the process the app is running under (0.9.9+)
* CHOCOLATEY_VERSION_PRODUCT = the version of Choco that may match CHOCOLATEY_VERSION but may be different (0.9.9+)
- it's based on git describe
* IS_ADMIN = Is the user an administrator? But doesn't tell you if the process is elevated. (0.9.9+)
* chocolateyInstallOverride = Not for use in package automation scripts. (0.9.9+)
* chocolateyInstallArguments = the installer arguments meant for the native installer. You should use chocolateyPackageParameters intead. (0.9.9+)

View File

@@ -2,6 +2,6 @@
<packages>
<package id="CommandLineParser" version="1.9.71" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="WixSharp" version="1.0.35.3" targetFramework="net45" />
<package id="WixSharp.bin" version="1.0.35.3" targetFramework="net45" />
<package id="WixSharp" version="1.3.0.0" targetFramework="net45" />
<package id="WixSharp.bin" version="1.3.0.0" targetFramework="net45" />
</packages>

View File

@@ -10,7 +10,7 @@ You can also install it from our public feed which might have newer versions fas
## How to use
Create a json config file that looks something like this
Create a json config file that looks something like this. The upgrade code must be a unique uuid, that will identify your msi.
```json
@@ -30,8 +30,37 @@ Create a json config file that looks something like this
```
then call QuikPak.exe -c path\to\your\config.json -x path\to\your\web\content
then call QuikPak.exe -c path\to\your\config.jsondfsa -x path\to\your\web\content
## TODO
## Certificates
Allow someone to include a certificate optionally for secure bindings
You can also add certificates to your json bindings.
```json
{
"UpgradeCode": "317e4313-2314-46e9-ae7e-6cdfee60c05d",
"Name": "terribledev",
"Version": "1.0.0.1",
"Endpoints": [
{
"port": 10000,
"DnsName": "*",
"Secure": false
},
{
"port": 8000,
"DnsName": "localhost",
"Secure" : false
}
],
"Certificates":[
{
"Name": "MyCert",
"Path": "awesome.pfx",
"Password": "password"
}
]
}
```

View File

@@ -1,12 +0,0 @@
{
"UpgradeCode": "317e4313-2314-46e9-ae7e-6cdfee60c05d",
"Name": "MyWebsite",
"Version": "1.0.0",
"Endpoints": [
{
"port": 80,
"DnsName": "mywebsite.com",
"Secure": false
}
]
}