I am trying to find the install directory for SQL server. So that I can copy the dlls for a custom SSIS task into it.
The following code runs but its not copying my files. Its not stopping either so I am assuming that it has found some value for ISSQLSERVERSERVICEINSTALLED
I am very new to wix this is the first time I have tried to read from the register.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Daimto OpenWeather for SSIS" Language="1033" Version="1.0.0.0" Manufacturer="DAIMTO" UpgradeCode="84543418-55c4-48c0-b5be-2496fb84ffb6">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perUser" InstallPrivileges="elevated" AdminImage="yes" />
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Feature Id="SSISMSSQL" Title="SSIS Components" Display='expand' Level='1'>
<ComponentRef Id='SSISPipelineComponents' />
<ComponentRef Id='SSISConnections' />
</Feature>
<UIRef Id="WixUI_Minimal"/>
</Product>
<!-- Get the directory name-->
<Fragment>
<Property Id="SQLSERVERINSTALLFOLDER">
<RegistrySearch Id='InstallDir'
Type='raw'
Root='HKLM'
Key="SOFTWARE\Microsoft\Microsoft SQL Server\100" Name="VerSpecificRootDir" />
</Property>
<Condition Message='Install Folder not found'>SQLSERVERINSTALLFOLDER</Condition>
</Fragment>
<!-- Build directory structure. http://blogs.msdn.com/b/syamp/archive/2012/09/30/wix-search-for-install-path-from-registry.aspx -->
<Fragment>
<Directory Id = "TARGETDIR" Name="SourceDir">
<Directory Id="SQLSERVERINSTALLFOLDER" >
<Directory Id="DTSDir" Name="DTS">
<Directory Id="PIPELINECOMPONENTS" Name="PipelineComponents" />
<Directory Id="CONECTIONS" Name="Connections" />
</Directory>
</Directory>
</Directory>
<!-- Set tarit dir to c: -->
<SetDirectory Id="TARGETDIR" Value="[WindowsVolume]" />
</Fragment>
<!-- copie files. -->
<Fragment>
<ComponentGroup Id="SSISPipelineComponentsgrp" Directory="PIPELINECOMPONENTS">
<Component Id="SSISPipelineComponents" Guid="{51CE96C7-42BF-4CE7-AE88-5C0085868062}" >
<File Id="Daimto.SSIS.Tasks.Current" Name="Daimto.SSIS.Tasks.Current.dll" DiskId="1" KeyPath="yes" Source="$(var.Daimto.SSIS.Tasks.Current.TargetPath)" />
</Component>
</ComponentGroup>
<ComponentGroup Id="SSISConnectionsgrp" Directory="CONECTIONS">
<Component Id="SSISConnections" Guid="{8DFFB861-18E4-4E08-8D4E-CAD99911E8A8}" >
<File Id="Daimto.SSIS.Connection" Name="Daimto.SSIS.Connection.dll" DiskId="1" KeyPath="yes" Source="$(var.Daimto.SSIS.Connection.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Update 1:
added "InstallPrivileges="elevated"" doesn't appear to help
adding a picture of reg.
Update 2:
I am getting some where. Its now installing on my Ddrive....
MSI (c) (CC:98) [13:37:09:112]: PROPERTY CHANGE: Adding TARGETDIR property. Its value is 'D:\'.
MSI (c) (CC:98) [13:37:09:112]: PROPERTY CHANGE: Adding ISSQLSERVERSERVICEINSTALLED property. Its value is 'D:\'.
MSI (c) (CC:98) [13:37:09:112]: PROPERTY CHANGE: Adding DTS property. Its value is 'D:\DTS\'.
MSI (c) (CC:98) [13:37:09:113]: PROPERTY CHANGE: Adding CONECTIONS property. Its value is 'D:\DTS\Connections\'.
MSI (c) (CC:98) [13:37:09:113]: PROPERTY CHANGE: Adding PIPELINECOMPONENTS property. Its value is 'D:\DTS\PipelineComponents\'.
Which leads me to believe that its not finding ISSQLSERVERSERVICEINSTALLED.
update 3:
Its now installing on the c drive. but its creating a directory called SQLSERVERINSTALLFOLDER, its not taking a value. log file says that the value of SQLSERVERINSTALLFOLDER is c: I cant figure out if its even able to find the registry value or not. I tried adding a condition to force it to fail but its not failing
<Condition Message='Install Folder not found'>SQLSERVERINSTALLFOLDER</Condition>
I finally got it working, the problem was that the fragment wasint being called I had to add <ComponentGroup Id="Fake" /> to the fragment then declare it with the other componentRefs.
The following code detects sqlserver 2008 copyes the connection manager and the data reader to the correct dts folders and installs them both in GAC after.
Hope this helps someone.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Daimto for SSIS (SQL Server 2008)" Language="1033" Version="1.0.0.0" Manufacturer="DAIMTO" UpgradeCode="84543418-55c4-48c0-b5be-2496fb84ffb6">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perUser" InstallPrivileges="elevated" AdminImage="yes" />
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Feature Id="SSISMSSQL" Title="SSIS Components" Display='expand' Level='1'>
<ComponentRef Id='SSISPipelineComponents' />
<ComponentRef Id='SSISConnections' />
<ComponentGroupRef Id="CopyGAC"/>
<ComponentGroupRef Id="Fake"/>
</Feature>
<UIRef Id="WixUI_Minimal"/>
</Product>
<!-- Get install location of SQL Server 2008 -->
<Fragment>
<Property Id="SQLSERVERINSTALLFOLDER">
<RegistrySearch Id='InstallDir'
Type='directory'
Root='HKLM'
Key="SOFTWARE\Microsoft\Microsoft SQL Server\100" Name="VerSpecificRootDir" />
</Property>
<Condition Message='Install Folder not found'>SQLSERVERINSTALLFOLDER</Condition>
<ComponentGroup Id="Fake" />
</Fragment>
<!-- map the directory structures -->
<Fragment>
<Directory Id = "TARGETDIR" Name="SourceDir">
<Directory Id="GAC" Name="GAC" />
<Directory Id="SQLSERVERINSTALLFOLDER" >
<Directory Id="DTSDir" Name="DTS">
<Directory Id="PIPELINECOMPONENTS" Name="PipelineComponents" />
<Directory Id="CONECTIONS" Name="Connections" />
</Directory>
</Directory>
</Directory>
<!-- Set TARGETDIR dir to c: -->
<SetDirectory Id="TARGETDIR" Value="[WindowsVolume]" />
</Fragment>
<!-- copie files. -->
<Fragment>
<!-- copy data reader files -->
<ComponentGroup Id="SSISPipelineComponentsgrp" Directory="PIPELINECOMPONENTS">
<Component Id="SSISPipelineComponents" Guid="{51CE96C7-42BF-4CE7-AE88-5C0085868062}" >
<File Id="Daimto.SSIS.Tasks.Current" Name="Daimto.SSIS.Tasks.Current.dll" DiskId="1" KeyPath="yes" Source="$(var.Daimto.SSIS.Tasks.Current.TargetPath)" />
<File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" DiskId="1" KeyPath="no" Source="$(var.ProjectDir)Externals\Newtonsoft.Json.dll" />
</Component>
</ComponentGroup>
<!-- copy connection manager file -->
<ComponentGroup Id="SSISConnectionsgrp" Directory="CONECTIONS">
<Component Id="SSISConnections" Guid="{8DFFB861-18E4-4E08-8D4E-CAD99911E8A8}" >
<File Id="Daimto.SSIS.Connection" Name="Daimto.SSIS.Connection.dll" DiskId="1" KeyPath="yes" Source="$(var.Daimto.SSIS.Connection.TargetPath)" />
</Component>
</ComponentGroup>
<!-- copy everything to GAC (remember dlls must be strong name signed.) -->
<ComponentGroup Id="CopyGAC" Directory="GAC">
<Component Id="GACCOPYCurrent" Guid="{4D4E991E-77F5-4CCF-9048-B4C0260B43BD}" >
<File Id="GACDaimto.SSIS.Tasks.Current" Name="Daimto.SSIS.Tasks.Current.dll" KeyPath="yes" Source="$(var.Daimto.SSIS.Tasks.Current.TargetPath)" Assembly=".net"/>
</Component>
<Component Id="GACCOPYJson" Guid="{65E88F62-E73F-4851-9422-6C8D1DA5183F}" >
<File Id="GACNewtonsoft.Json.dll" Name="Newtonsoft.Json.dll" KeyPath="yes" Source="$(var.ProjectDir)Externals\Newtonsoft.Json.dll" Assembly=".net"/>
</Component>
<Component Id="GACCOPYConnection" Guid="{2DCABCEA-62CD-4F0D-BCAC-395A079AF27A}" >
<File Id="GACDaimto.SSIS.Connection" Name="Daimto.SSIS.Connection.dll" KeyPath="yes" Source="$(var.Daimto.SSIS.Connection.TargetPath)" Assembly=".net"/>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Related
I'm configuring Active Directory Login for Sitecore 9.0.0. And I have issues with IsAdministrator role. I used the following map, but it didn't work.
Any idea about how to configure it?
<map name="Administrator Claim" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication">
<data hint="raw:AddData">
<source name="Administrator" />
<target name="IsAdministrator" value="true" />
</data>
</map>
You have to map http://www.sitecore.net/identity/claims/isAdmin claim in Sitecore.Owin.Authentication.IdentityServer.config file in the propertyInitializer section as follows:
<propertyInitializer>
<maps>
<map name="set IsAdministrator" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication">
<data hint="raw:AddData">
<source name="http://www.sitecore.net/identity/claims/isAdmin" value="true" />
<target name="IsAdministrator" value="true" />
</data>
</map>
</maps>
</propertyInitializer>
Read more details here.
I have been trying to understand the config of the log4net library and I think I have it except for some unexpected behavior.
I have a root logger that has a level set to INFO and another logger for a specific class that has level set to ERROR.
What I expected from this was that the class logger would only log at error and ignore the roots level since I had additivity set to false for the class logger. Here is the log4net.config I have at the moment:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="log.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="100KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<logger name="EveStatic.Config.ViewModel" additivity="false">
<level value="error"/>
<appender-ref ref="ConsoleAppender"/>
<appender-ref ref="RollingFileAppender"/>
</logger>
<root>
<level value="debug" />
<appender-ref ref="ConsoleAppender" />
<appender-ref ref="RollingFileAppender" />
</root>
</log4net>
</configuration>
In my AssemblyInfo.cs:
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
And in the class that loads the configuration:
log4net.Config.XmlConfigurator.Configure(new FileInfo("log4net.config"));
These two seem redundant but the configuration wont load unless I have the code part. Everything here is in a class library being used by another project.
Is this behavior expected and I don't understand the configuration and level overrides or am I forgetting something?
EDIT:
Here is how I instantiate and call the ILog. The the full class name is the name of the logger in the config plus the ConfiInfoViewModel:
private static readonly ILog LOG = LogManager.GetLogger(typeof(ConfigInfoViewModel));
...
LOG.Debug("Something buggy");
Also note that when testing the logging levels I had a log statement for each level in a series.
Your problem lays here
LogManager.GetLogger(typeof(ConfigInfoViewModel));
Internally this get resolved to
LogManager.GetLogger(typeof(ConfigInfoViewModel).FullName);
Now log4net is looking for a Logger named "EveStatic.Config.ConfigInfoViewModel" (result of typeof(ConfigInfoViewModel).FullName)
Because no Logger with that name is specified a new one with your default settings is used.
Also note that level specify a threshold, not a single level.
Example: level=warn means log warn an all levels above (error and fatal)
This question already has an answer here:
WPF-Log4Net used inside VSIX extension did not output log when installed at target VS
(1 answer)
Closed 4 years ago.
I have a WPF solution. I downloaded log4net dll, I added log4net.config and had set the "Copy to Output Directory" value as "Copy always".
log4net.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net>
<root>
<level value="ALL" />
<appender-ref ref="LogFileAppender" />
</root>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="myapp.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="5" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %level %logger - %message%newline" />
</layout>
</appender>
</log4net>
</configuration>
And I added the below line in AssemblyInfo.cs:
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
then the below code in my TestWindowControl.xaml.cs
public partial class TestWindowControl : UserControl
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public TestWindowControl()
{
XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));
log.Info("info testing");
log.Debug("debug testing");
log.Error("error testing");
log.Fatal("fatal testing");
log.Warn("warn testing");
}
}
But logs are not writing to the file. It's working in Console application but not working for WPF. Am I missing something?
Try to set the filter inside appender
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="WARN" />
<levelMax value="ERROR" />
</filter>
It sure looks like it should work. It throws no errors, steps through every line of code, but produces no log file. What is wrong here? It should produce a log file in the directory of the appender name, but no log file ever generates.
log4net.xml file:
<configuration>
<log4net debug="true">
<appender name ="task_appender" type="log4net.Appender.RollingAppender">
<file value="C:\Users\ryan\Documents\Visual Studio 2017\Workout Project\GPWorkouts\blablabla.txt"></file>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBacks value="2"/>
<maximumFileSize value="5000KB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline"></conversionPattern>
</layout>
</appender>
<root>
<level value="DEBUG"/>
</root>
<logger name="Task">
<level value="DEBUG"/>
<appender-ref ref="task_appender"/>
</logger>
</log4net>
</configuration>
application file:
public partial class MainWindow : Window
{
static protected ILog log = LogManager.GetLogger("Task");
static void log4net_demo()
{
FileInfo fi = new FileInfo("log4net.xml");
log4net.Config.XmlConfigurator.Configure(fi);
log4net.GlobalContext.Properties["host"] = Environment.MachineName;
}
public MainWindow()
{
InitializeComponent();
log4net_demo();
log.Info("This is the information log level");
log.Debug("This is the debugging log level");
log.Error("This is the error log level");
log.Fatal("This is the fatal log level");
}
Looks like some typo in your log4net config, the correct appender type name is log4net.Appender.RollingFileAppender
In your xml, it was given as log4net.Appender.RollingAppender
Here is the corrected xml
<configuration>
<log4net debug="true">
<appender name ="task_appender" type="log4net.Appender.RollingFileAppender">
<file value="C:\Users\ryan\Documents\Visual Studio 2017\Workout Project\GPWorkouts\blablabla.txt"></file>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBacks value="2"/>
<maximumFileSize value="5000KB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline"></conversionPattern>
</layout>
</appender>
<root>
<level value="DEBUG"/>
</root>
<logger name="Task">
<level value="DEBUG"/>
<appender-ref ref="task_appender"/>
</logger>
</log4net>
</configuration>
I have a Wpf solution that is composed of 2 projects one of them is the windows application and the other is a class library. When I try to create the installer it works fine but when I run the app it crashes.
When I put all the code in a single project it all works just fine.
So, how do I make it work when there are multiple projects?
My Product.wxs is:
<Product Id="8748CF04-E8D3-4A2B-B3F5-22E50B3A8E49"
Name="MyApp" Language="1033" Version="1.0.0.0" Manufacturer="My System Pvt Ltd"
UpgradeCode="8748CF04-E8D3-4A2B-B3F5-22E50B3A8E49">
<Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine"
InstallPrivileges="elevated" ReadOnly="yes"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!--Add Cab1.cab File inside the Package-->
<Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" />
<!--Here We Install Our Main App-->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="MY System Pvt Ltd"/>
</Directory>
<!-- Step 1: For the Program Menu -->
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="My System Pvt Ltd"/>
</Directory>
<!--Step 2:For Desktop Folder-->
<Directory Id="DesktopFolder"/>
<!--Step 3:For StartUp Folder-->
<Directory Id="StartupFolder"/>
</Directory>
<!--Step 4 :Add Main App exe-->
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="myapplication.exe" Guid="84C5B9E8-FD90-4EA8-A502-B08AC9B38D39">
<File Source="C:\Users\petric\Downloads\Compressed\WixDemoWPFAppVS2012\WixDemoWPFAppVS2012\WixDemoWPFAppVS2012\WpfApplication2\bin\Debug\WpfApplication2.exe" Name="MYApp.exe"
Id="MyAppEXE" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Step 1.1: Add the shortcut to your installer package Program Menu or Start Menu-->
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="1A437020-D5C9-450C-9B3D-33957994780A">
<!--Add Shortcut of the Application in start Menu-->
<Shortcut Id="ApplicationStartMenuShortcut" Name="MyApp" Description="My Application Description"
Target="[INSTALLFOLDER]MyApp.exe" WorkingDirectory="INSTALLFOLDER">
<!--Add Icon to the ShortCut-->
<Icon Id="MYPMenuIcon" SourceFile=".\Desktop.ico" />
</Shortcut>
<!--Remove the Folder At time of Uninstall-->
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key='Software\[Manufacturer]\[ProductName]'
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Step 2.1: Add the shortcut to your installer package For DeskTop-->
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationDeskShortcutComp" Guid="40127963-856D-460D-9E1B-4C10EB65835B">
<Shortcut Id="ApplicationDeskShortcut" Name="MYAppDesk"
Description="My Application Description" Target="[INSTALLFOLDER]MyApp.exe"
WorkingDirectory="INSTALLFOLDER">
<Icon Id="MYDeskIcon" SourceFile=".\Desktop.ico" />
</Shortcut>
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key='Software\[Manufacturer]\[ProductName]'
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!--Step 3.1: add Shortcut to StartUp Folder to run application when you login-->
<DirectoryRef Id="StartupFolder">
<Component Id="ApplicationStartUpShortcutComp" Guid="843B6A2E-AB61-40C7-BE49-FBCD7F81E35D">
<Shortcut Id="ApplicationStartUpDeskShortcut" Name="MYAppDesk" Description="My Application Description"
Target="[INSTALLFOLDER]MyApp.exe" WorkingDirectory="INSTALLFOLDER">
<Icon Id="MyIconStartUp" SourceFile=".\Desktop.ico" />
</Shortcut>
<RemoveFolder Id="StartupFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key='Software\[Manufacturer]\[ProductName]'
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!--Add Component-->
<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentRef Id="myapplication.exe" />
<!--Step 1.2:Add Start menu or program Shortcut-->
<ComponentRef Id="ApplicationShortcut" />
<!--step 2.2Add DeskTop Shortcut-->
<ComponentRef Id="ApplicationDeskShortcutComp" />
<!--step 3.2Add DeskTop Shortcut-->
<ComponentRef Id="ApplicationStartUpShortcutComp"/>
</Feature>
I followed this tutorial :
http://www.c-sharpcorner.com/UploadFile/cb88b2/getting-started-with-wix-windows-installer-xml-in-vs2012/
Well I figured it out myself eventually
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="myapplication.exe" Guid="84C5B9E8-FD90-4EA8-A502-B08AC9B38D39">
<File Source="C:\Users\petric\Downloads\Compressed\WixDemoWPFAppVS2012\WixDemoWPFAppVS2012\WixDemoWPFAppVS2012\WpfApplication2\bin\Debug\WpfApplication2.exe" Name="MYApp.exe"
Id="MyAppEXE" KeyPath="yes"/>
</Component>
</DirectoryRef>
should be writen as :
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="myapplication.exe" Guid="84C5B9E8-FD90-4EA8-A502-B08AC9B38D39">
<File Source="$(var.WpfApplication2.TargetPath)" Name="MYApp.exe"
Id="MyAppEXE" KeyPath="yes"/>
</Component>
<Component>
<File Id="dotNetClass.Output"
Name="WpfApplication3.dll"
Source="$(var.WpfApplication3.TargetPath)"
KeyPath="yes" />
</Component>
</DirectoryRef>
to include some dll of a project called WpfApplication3.