I am building a WCF service project and now i want to add a Wix based setup project also into the solution (VS.NET 2013). I am using the Wix toolset for the first time. I am using the latest version of Wix toolset Ver 3.10.
Please help me out in laying down the steps required in filling up the .wxs file.
Here is the xml content from ImportService.wxs:-
<?xml version="1.0" encoding="UTF-8"?><Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="$(var.outputName)" Language="1033" Version="1.0.0.0" Manufacturer="Client" UpgradeCode="80d51001-e699-47b8-9221-fc6633fddf15">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64" />
<MajorUpgrade DowngradeErrorMessage="A newer version of Import Service is already installed." />
<Media Id="1" Cabinet="Cab1.cab" EmbedCab="yes"/>
<MediaTemplate />
<Feature Id="ProductFeature" Title="$(var.outputName)" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="Client" Name="Client" >
<Directory Id="INSTALLFOLDER" Name="$(var.outputName)" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!--<Component Id="ProductComponent" Guid="93A6A063-F63D-455A-BD63-A21D32D15CE5" Win64="yes">
</Component>-->
</ComponentGroup>
</Fragment>
Please suggest how to add the WCF .svc & other files into the ComponentGroup area in the wix file.
You can publich service using IIS.
<!-- Use DISM to setup IIS (see also http://support.microsoft.com/kb/2736284) -->
<!-- Build path to dism.exe (full path is important, just calling dism.exe without path will fail) -->
<CustomAction Id="InstallIISSetProperty" Property="InstallIIS" Execute="immediate"
Value=""[System64Folder]dism.exe" /Online /Enable-Feature /All /FeatureName:IIS-WebServerRole /FeatureName:IIS-ASPNET45 /FeatureName:IIS-ManagementConsole /FeatureName:IIS-ISAPIFilter /FeatureName:IIS-NetFxExtensibility45 /FeatureName:NetFx4Extended-ASPNET45" />
<!-- Call dism.exe quietly (without showing command prompt).
(see also http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html) -->
<CustomAction Id="InstallIIS" BinaryKey="WixCA" DllEntry="CAQuietExec64"
Execute="deferred" HideTarget="no" Return="ignore" Impersonate="no"/>
...
<InstallExecuteSequence>
<Custom Action="InstallIISSetProperty" After="CostFinalize">
<![CDATA[NOT Installed]]>
</Custom>
<Custom Action="InstallIIS" Before="WriteRegistryValues">
<![CDATA[NOT Installed]]>
</Custom>
</InstallExecuteSequence>
Related
so I'm trying to generate a dynamic installer which harvest all the files from the published web project (into WebComponents.wxs). It is already working fine but as soon as I delete a file from the Web.csproj it gets confused with the generated WebComponents.wxs. So my current setup is: when building the Installer.wixproj it also builds the Web.csproj, which publishes itself for the installer. Adding new files is working fine.
Here is a part from the Installer.wixproj:
<PropertyGroup>
<WebSiteSource>..\Web\</WebSiteSource>
<ReleaseWebConfig>Web_setup.config</ReleaseWebConfig>
<PublishFolderName>app.publish\</PublishFolderName>
<PublishFolder>..\Web\bin\$(PublishFolderName)</PublishFolder>
<MsiOut>D:\MA01.ATOUR\src\Installer\bin\Release\VieTour.msi</MsiOut>
<WebSiteContentCode>WebComponents.wxs</WebSiteContentCode>
<WebSiteContentObject>WebComponents.wixobj</WebSiteContentObject>
<WixPath>C:\Program Files (x86)\WiX Toolset v3.11\bin\</WixPath>
</PropertyGroup>
<ItemGroup>
<WixCode Include="$(WebSiteContentCode)" />
</ItemGroup>
<Target Name="CreateInstaller" AfterTargets="Build">
<Exec Command=""$(WixPath)heat" dir $(PublishFolderName) -dr dirVieTour -ke -srd -cg WebComponents -var var.publishDir -gg -out $(WebSiteContentCode)" ContinueOnError="false" WorkingDirectory="." />
<Exec Command=""$(WixPath)candle" -ext WixIISExtension -ext WixUtilExtension -ext WiXNetFxExtension -dpublishDir=$(PublishFolderName) -dMyWebResourceDir=. #(WixCode, ' ')" ContinueOnError="false" WorkingDirectory="." />
</Target>
The generated WebComponents.wxs looks something like this:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="directoryXY">
<Directory Id="dirEA772C6FDF885BD02D519055C6A5F7D4" Name="bin" />
<Directory Id="dir9C6C7F6C7D56234126D1F3268C213149" Name="JavaScript" />
<Directory Id="dir1CD7F397F22159CC91531C851F168C0A" Name="Properties" />
<Directory Id="dir08FBA1551757E5AA339492A08A61A382" Name="Views" />
<Directory Id="dirCB77DB5DBF1C1B2953DA0699797F08FC" Name="wwwroot" />
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="WebComponents">
<Component Id="cmp2DE1A50D21FA3CFD8D4260FD2285BA4D" Directory="dirVieTour" Guid="{50A1AAC7-F3FC-4A20-9784-B6F24214B4AA}">
<File Id="fil989DA2FC3E666A81C52CD089644582AF" KeyPath="yes" Source="$(var.publishDir)\favicon.ico" />
</Component>
<Component Id="cmp1F31A992017C2787A7EDBD35AF00D862" Directory="dirVieTour" Guid="{0AFAC57B-01A2-404D-966D-524FBD0557B2}">
<File Id="filF20D2F7FF3255C45551F52F87F2E6D40" KeyPath="yes" Source="$(var.publishDir)\Global.asax" />
</Component>
...
In the Product.wxs I reference the WebComponents:
<Feature Id="ProductFeature" Title="$(var.ProductName)" Level="1">
<ComponentGroupRef Id="WebComponents" />
</Feature>
As soon as I delete a file from the Web.csproj and try to build the
installer I get the following error message:
The system cannot find the file 'app.publish\FileThatGotDdeleted'
Does anyone know how to handle this in WIX?
Thanks in advance!
Don't you need to simply republish the web project after you delete the file? I.e. you seem to feed wix from the published files.
I am running an aspnet core consol program on centos.I have set up nlog.config to Generate log files. All is well in my windows development environment,but when I run it on Centos I can't get logs files using my settings.
My setting:
<target xsi:type="File" name="target1" fileName="${currentdir}\logs\${shortdate}-nlog.log" ... />
In centos:(click to show img)
It will create a file name "demoBS\logs\2019-06-26-nlog.log" in parent directory.
Thank you and look forward to your help!
Ps: Nlog.config
<?xml version="1.0" encoding="utf-8" ?>
<!-- XSD manual extracted from package NLog.Schema: https://www.nuget.org/packages/NLog.Schema-->
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogFile="${currentdir}\logs\${shortdate}-internal.log"
internalLogLevel="Info" >
<!-- the targets to write to -->
<targets>
<!-- write logs to file -->
<target xsi:type="File" name="target1" fileName="${currentdir}\logs\${shortdate}-nlog.log"
layout="${date}|${level:uppercase=true}|${message} ${exception}|${logger}|${all-event-properties}" />
<target xsi:type="Console" name="target2"
layout="${date}|${level:uppercase=true}|${message} ${exception}|${logger}|${all-event-properties}" />
</targets>
<!-- rules to map from logger name to target -->
<rules>
<logger name="*" minlevel="Trace" writeTo="target2,target1" />
</rules>
</nlog>
Make sure to use Unix-path instead of Windows-path. Ex:
${currentdir}/logs/${shortdate}-nlog.log
Turn the slashes the other way
My setup app should create user in sql server and restore a database. I do it as two separate projects;one to copy the database backup file to the machine, and the other one to do the actions. I'm planning to make it a single project.
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder" Name="Program Files" >
<Directory Id="INSTALLFOLDER" Name="My Produact name" >
<Directory Id="DBDIR" Name="DB PreReq" ></Directory>
</Directory>
</Directory>
</Directory>
<UI Id="DbConfigSetupUI" >
<TextStyle Id="DlgFont8" FaceName="Tahoma" Size="8" ></TextStyle>
<TextStyle Id="DlgTitleFont" FaceName="Tahoma" Size="8" Bold="yes" ></TextStyle>
<UIRef Id="Custom_WixUI_Mondo" />
<UIRef Id="WixUI_ErrorProgressText" />
<InstallUISequence >
<Custom Action="CreateUserWithSa" Before="FileCost" >NOT Installed</Custom>
<Custom Action="CreateUserWithWindows" After="CreateUserWithSa" >(SARETURN="fail") AND NOT Installed</Custom>
<Show Dialog="ConnectionStringDialog" After="CreateUserWithWindows" >(WINDOWSRETURN="fail") AND NOT Installed</Show>
<Custom Action="CreateUserWithPrompt" After="ConnectionStringDialog" >(DBLOGIN AND PASSWORD) AND NOT Installed</Custom>
<Custom Action="CreateDB" After="CreateUserWithPrompt" >(SARETURN="pass" OR WINDOWSRETURN="pass" OR PROMPTRETURN="pass") AND NOT Installed</Custom>
</InstallUISequence>
</UI>
</Fragment>
Here the files are not being copied(components are placed in a separate file), but the custom actions are being done. Since the backup file is necessary to restore. I need that to happen first. Is there a way to achieve that?
Schedule your custom action to run after InstallFinalize in the InstallExecuteSequence. You are guaranteed that your files will be installed by that point. Be warned you will need to store your property/data values if your action needs to access them.
I made a wix installer which successfully enables the IIS with asp by running the command Aspnet_regiis.exe on 64 bit system. However, this command has different path in .net framework folder depending on 32 bit or 64 bit system according to this linkIIS registration with ASP
on 32 bit system
%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
and on 64 bit system
%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -i
I need to extend my installer to cover both 32 bit and 64 bit platforms. I tried to this answer answer on platform independent by defining a preprocess variable based on the platform as follows:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?if $(var.Platform) = x64 ?>
<?define IISRegCommand = "C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i" ?>
<?else ?>
<?define IISRegCommand = "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i" ?>
<?endif ?>
<Product Id="*" Name="IISRegistration" Language="1033" Version="1.0.0.0" Manufacturer="Eurotherm By Schneider-Electric" UpgradeCode="4bfb41e4-5701-4a47-9c4c-cdb657ab7a62">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" />
<Feature Id="ProductFeature" Title="IISRegistration" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<CustomAction Id="IISRegistration" Directory="INSTALLFOLDER"
ExeCommand="$(var.IISRegCommand)"
Return="check"/>
<InstallExecuteSequence>
<Custom Action="IISRegistration" After="InstallFiles"></Custom>
</InstallExecuteSequence>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="CommonAppDataFolder">
<Directory Id="Company" Name="Company">
<Directory Id="INSTALLFOLDER" Name="Application" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent" Guid="">
<File Id="File1" Name="IISRegistration.txt" Source="IISRegistration.txt"></File>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
However, when I compile it with candle.exe I get the following error:
"error CNDL0150: Undefined preprocessor variable '$(var.Platform)'"
BTW, I am using wix 3.11.
Is there any way I can resolve this?
Try to add this code to the .wixproj:
<PropertyGroup>
<DefineConstants>
$(DefineConstants);
Platform=$(Platform)
</DefineConstants>
</PropertyGroup>
I am using Wix 3.6 to install a Web application to IIS 7 and the install works correctly but when uninstalling the application either with Add/Remove Programs or with MSIExec I get the following error in IIS.
There was an error while performing this operation.
Details:
The application '/' does not exist.
The error in System log is as follows.
Site 1 has no root application defined, so the site will be ignored.
The log file on uninstall when using MSIExec and the /qb option shows just this one error and it doesnt seem like it could cause this type of problem where the Default Web Site directory in IIS becomes corrupt but perhaps it can.
Action start 7:04:40: ExitDialog. DEBUG: Error 2726: Action not
found: ExitDialog The installer has encountered an unexpected error
installing this package. This may indicate a problem with this
package. The error code is 2726. The arguments are: ExitDialog, ,
Action ended 7:04:40: ExitDialog. Return value 0. Action ended
7:04:40: INSTALL. Return value 1.
Here is the relevant portion of the wix file. If anyone has any ideas that can point me in the right direction they will be greatly appreciated. Thanks in advance.
<Product
Name="$(var.WebName)"
Id="*"
UpgradeCode="GUID"
Manufacturer="MyCo"
Version="$(var.ProductVersion)"
Language="1033">
<Package Id='*'
InstallScope="perMachine"
Manufacturer="MyCo"
InstallerVersion="200"
Languages="1033"
Compressed="yes"/>
<MajorUpgrade Schedule="afterInstallValidate"
DowngradeErrorMessage='A later version of this application is already installed. Setup will now exit'></MajorUpgrade>
<Media Id="1" Cabinet="MyProduct.cab" EmbedCab="yes" />
<Property Id="IISROOT">
<RegistrySearch Id="WEBROOT" Root="HKLM" Key="Software\Microsoft\InetStp" Name="PathWWWRoot" Type="raw" />
</Property>
<Property Id="WIXUI_INSTALLDIR" Value="FILEINSTALLDIR" Secure="yes" >
<RegistrySearch Id="WIXUI_INSTALLDIR" Type="raw" Root="HKLM" Key="SOFTWARE\MyCo" Name="InstallDir" />
</Property>
<Property Id="WIXUI_VIRTUALDIR" Secure="yes" Value="VIRTUALDIR" >
<RegistrySearch Id="WIXUI_VIRTUALDIR" Type="raw" Root="HKLM" Key="SOFTWARE\MyCo" Name="WixUiVirtualDir" />
</Property>
<Property Id="VIRTUALDIR" Secure="yes" Hidden="no" >
<RegistrySearch Id="VIRTUALDIR" Type="raw" Root="HKLM" Key="SOFTWARE\MyCo" Name="VirtualDir" />
</Property>
<CustomAction Id="FILEINSTALLDIR" Property="FILEINSTALLDIR" Value="[IISROOT]\[VIRTUALDIR]" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="IISROOT" Name=".">
<Directory Id="FILEINSTALLDIR" Name="AppDirectory">
<Component Id="MyCo_AppComponent" Guid="GUID">
<File Source=...
</Component>
</Directory>
</Directory>
</Directory>
<iis:WebSite Id="DefaultWebSite" Description="Default Web Site" SiteId="*">
<iis:WebAddress Id="AllUnassigned" Port="1" />
</iis:WebSite>
<DirectoryRef Id="FILEINSTALLDIR">
<Component Id="MyCoSiteComponent" Guid="GUID" KeyPath="yes">
<iis:WebVirtualDir Id='AppComponentVirtDir' Alias='[VIRTUALDIR]' Directory='FILEINSTALLDIR'
WebSite='DefaultWebSite'>
<iis:WebDirProperties Id="AppComponentVirtDirProperties"
AnonymousAccess="no" BasicAuthentication="no"
WindowsAuthentication="yes" />
<iis:WebApplication Id='MyAppName' Name='[VIRTUALDIR]' Isolation='medium' />
</iis:WebVirtualDir>
</Component>
</DirectoryRef>
I figured out what I was doing wrong, there was a registry setting that was named differently in the lookup then it was in the removal, since I didn't include that in the original code I will include the bad code example below. Note the Registry path is different 1) MyCo 2) MyCompany (this is for demonstration purposes but you get my drift). This caused the Default Web Site to become corrupt and had to be replaced. So in short make sure the Registry key names you make are named correctly! :) This was a painful one.
Where I set the value from the Registry:
<Property Id="WIXUI_VIRTUALDIR" Secure="yes" Value="VIRTUALDIR" >
<RegistrySearch Id="WIXUI_VIRTUALDIR" Type="raw" Root="HKLM" Key="SOFTWARE\MyCo" Name="WixUiVirtualDir" />
</Property>
Where I remove the Registry setting:
<DirectoryRef Id="FILEINSTALLDIR">
<Component Id="RegistryEntries" Guid="GUID">
<RegistryKey Root="HKLM"
Key="SOFTWARE\MyCompany"
Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="WixUiVirtualDir" Value="[VIRTUALDIR]" />
</RegistryKey>
</Component>
</DirectoryRef>