Wix Installer
This commit is contained in:
@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>3.10</ProductVersion>
|
||||
<ProjectGuid>7001a624-65ab-49c2-829b-9cd39fd49ae3</ProjectGuid>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<OutputName>ConsoleApp-$(Configuration)-$(Platform)</OutputName>
|
||||
<OutputType>Package</OutputType>
|
||||
<Cultures>;</Cultures>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
|
||||
<DefineConstants>Debug</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
|
||||
<DefineConstants>Debug</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Components.wxs" />
|
||||
<Compile Include="ComponentsGenerated.wxs" />
|
||||
<Compile Include="Directories.wxs" />
|
||||
<Compile Include="Product.wxs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Common.wxl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ConsoleApp1\ConsoleApp1.csproj">
|
||||
<Name>ConsoleApp1</Name>
|
||||
<Project>{f7d45e05-717f-4cfd-81e4-58854125aa0f}</Project>
|
||||
<Private>True</Private>
|
||||
<DoNotHarvest>True</DoNotHarvest>
|
||||
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
|
||||
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WixExtension Include="WixUtilExtension">
|
||||
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
|
||||
<Name>WixUtilExtension</Name>
|
||||
</WixExtension>
|
||||
<WixExtension Include="WixUIExtension">
|
||||
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
|
||||
<Name>WixUIExtension</Name>
|
||||
</WixExtension>
|
||||
</ItemGroup>
|
||||
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
|
||||
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
|
||||
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
|
||||
</Target>
|
||||
<!-- Before build -->
|
||||
<Target Name="BeforeBuild">
|
||||
<!-- Clean previous build folder -->
|
||||
<Exec Command="rd /s /q ..\ConsoleApp1\bin\$(Configuration)\netcoreapp2.0\win-$(Platform)" />
|
||||
<!-- Publish dotnet core app -->
|
||||
<Exec Command="dotnet publish ..\ConsoleApp1\ConsoleApp1.csproj -c $(Configuration) -r win-$(Platform)" />
|
||||
<!-- Get assembly version -->
|
||||
<GetAssemblyIdentity AssemblyFiles="..\ConsoleApp1\bin\$(Configuration)\netcoreapp2.0\win-$(Platform)\ConsoleApp1.dll">
|
||||
<Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
|
||||
</GetAssemblyIdentity>
|
||||
<!-- Define some variables we need -->
|
||||
<PropertyGroup>
|
||||
<DefineConstants>BuildVersion=%(AssemblyVersion.Version);BasePath=..\ConsoleApp1\bin\$(Configuration)\netcoreapp2.0\win-$(Platform)\publish</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Harvest file components from publish folder -->
|
||||
<HeatDirectory
|
||||
OutputFile="ComponentsGenerated.wxs"
|
||||
DirectoryRefId="INSTALLFOLDER"
|
||||
ComponentGroupName="PublishedComponents"
|
||||
SuppressCom="true"
|
||||
Directory="..\ConsoleApp1\bin\$(Configuration)\netcoreapp2.0\win-$(Platform)\publish"
|
||||
SuppressFragments="true"
|
||||
SuppressRegistry="true"
|
||||
SuppressRootDirectory="true"
|
||||
AutoGenerateGuids="false"
|
||||
GenerateGuidsNow="true"
|
||||
ToolPath="$(WixToolPath)"
|
||||
PreprocessorVariable="var.BasePath"
|
||||
/>
|
||||
|
||||
</Target>
|
||||
|
||||
<Target Name="AfterBuild">
|
||||
|
||||
<!-- Get assembly version -->
|
||||
<GetAssemblyIdentity AssemblyFiles="..\ConsoleApp1\bin\$(Configuration)\netcoreapp2.0\win-$(Platform)\ConsoleApp1.dll">
|
||||
<Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
|
||||
</GetAssemblyIdentity>
|
||||
|
||||
<!-- Rename and move final MSI -->
|
||||
<Exec Command="if not exist Installs mkdir Installs" />
|
||||
<Exec Command="move bin\$(Configuration)\$(OutputName).msi Installs\ConsoleApp-%(AssemblyVersion.Version)-$(Configuration)-$(Platform).msi" />
|
||||
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user