Checkstyle avoid of logging files without error - properties

I want to know how to avoid logging of files without errors.
Here is the example of report:
<file name="/applications/comp/Editor.java"></file>
<file name="/applications/comp/Component.java">
<error line="73" severity="warning" message="Line is longer than 120 characters (found 271)." source="com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck"/>
</file>
Is there a way to ignore filename Editor.java which doesn't have erros ?

Related

How to modify the component .xml file with utils:XmlFile using WIX?

I am trying to create an installer which also installs the xml-file depending on input values, entered in separate dialog. Here
</Component>
<Component Id="ConfigXMLDocument">
<File Id ="Config" KeyPath="yes" DiskId="1" Vital ="yes" Source="$(var.Server.ProjectDir)config.xml"/>
<CreateFolder Directory="INSTALLFOLDER">
<util:PermissionEx User="Users" ChangePermission="yes" GenericAll="yes"/>
</CreateFolder>
<util:XmlFile ElementPath ="root/Server/servername" File ="[INSTALLFORDER]config.xml" Sequence="1" Id ="SERVERNAME"
Action ="setValue" Value ="THIS VALUE IS NOT BEING SET" SelectionLanguage="XPath"/>
<util:XmlFile ElementPath ="root/Server/listenport" File ="[INSTALLFORDER]config.xml" Sequence="2" Id ="PORT"
Action ="setValue" Value ="THIS ONE EITHER"/>
</Component>
The problem is that there are no errors and all the paths are resolved correctly, but the installed file remains the same as original.
If I try to change any other XML-file, It works, but not the one installed.
I found simmilar issues online, but no answers fixed mine.
Is it possible that XmlFile is just changing file before file is installed? And what else can cause such problem?
It appeared to be not one, but two issues.
The first one was to use FIle ID instead of path, so I replaced this
File ="[INSTALLFORDER]config.xml"
with this:
File ="[#Config]"
But It still didn`t work, during the installation appeared an error that the installer cannot find the file config.xml, so i changed the InstallExecuteSequence to this:
<InstallExecuteSequence>
<Custom Action="SchedXmlFile" After="InstallFiles" />
</InstallExecuteSequence>
UPD. This still did not work fine. WIX could not open the file with error:
Failed to open XML file path/config.xml, system error: -2147024786
The error appeared to be that wix cannot recognize the BOM in the XML file for some reason:
<?xml version"1.0" encoding="UTF-8" ?>
So i just removed it.
Hope this helps.

Failed to open XML file - Wix unable to update appsettings.json

I am using Wix to create MSI installers. My requirement is to pass parameters while installing msi from the command line and update' theappsettings.json` with the values passed.
To achieve this, I have added below property and component.
<Property Id="ApplicationLog.pathFormat" />
<Component Id="config" Guid="*">
<File Id="appconfig" Source="$(var.BasePath)\appsettings.json" KeyPath="yes" Vital="yes"/>
<util:XmlFile
Id="_pathFormat_" File="$(var.BasePath)\appsettings.json"
Action="setValue"
Name="pathFormat" Value="[pathFormat]"
ElementPath="/ApplicationLog/Serilog/WriteTo/Args/"
Sequence='1' />
</Component>
I have passed the values as follow while installing
C:\work\Installer\bin\Debug>MyService-Debug-x86.msi pathFormat="value1"
But I get below error
Failed to open XML file ....\Installer\bin\Debug\netcoreapp2.1\win-x86\publish\appsettings.json. system error -2147024786
Additional Information
There was ICE30 error,
ICE30: The target file 'l-racj8d.jso|appsettings.json' is installed in '[ProgramFilesFolder]\MyService\' by two different components on an LFN system: 'config' and 'cmpF82FCA80BBAF44D285C97F10993DEEE6'.
Which resolved by changing the ICE validation-> Suppress ICE validation
But why installer unable to open the json app settings? I am running the installer in administrator mode.
Update
I have changed $(var.BasePath) to '[INSTALLDIR]'
<Component Id='config' Guid='*'>
<File Id='jsonconfig' Source='[INSTALLDIR]appsettings.json' KeyPath="yes" Vital="yes"/>
<util:XmlFile Id='xpathFormat' File='[INSTALLDIR]appsettings.json'
Action='setValue' Name='pathFormat' Value='[ApplicationLog.pathFormat]'
ElementPath='/ApplicationLog/Serilog/WriteTo/Args/' Sequence='1' />
</Component>
But I am getting
The system cannot find the file '[INSTALLDIR]appsettings.json'.
Is it because appsettings.json is not yet copied to [INSTALLDIR]?? If yes, then how to achieve this?

In Wix, how can I avoid hardcoding a file source for a file that already exists in the installation directory?

In my .wxs file, I have the following file declaration. This file already exists in the installation directory. It is not being copied from the source directory. I need to update it using util:XmlConfig during the install. The XmlConfig part is working.
<File Id="AppConfig" Name="Dynamics.exe.config" Source="C:\Program Files (x86)\Microsoft Dynamics\GP2010\Dynamics.exe.config" />
The problem is I can't assume the file is always going to exist in that same location. I'd really like to simply reference it like so:
<File Id="AppConfig" Name="[#INSTALLDIR]\Dynamics.exe.config" />
However, that fails with the following message:
> light.exe ....
The system cannot find the file 'SourceDir\....\[#INSTALLDIR]\Dynamics.exe.config'
How can I say "the file already exists in the installation directory, use that file during the installation, and do not validate for it now"?
Directories are available with bracket notation as though they were regular properties. If you don't need to install the Dynamics.exe.config but just access it with XmlConfig elements, you can simply reference that directory and don't need to bother with the File element:
<Component Id="Dynamics.exe.config" KeyPath="yes" Guid="*">
<util:XmlConfig Id="Dynamics.exe.config.XmlConfig1"
On="install"
Action="..."
File="[INSTALLDIR]\Dynamics.exe.config"
...
/>
<util:XmlConfig Id="Dynamics.exe.config.XmlConfig2"
On="install"
Action="..."
File="[INSTALLDIR]\Dynamics.exe.config"
...
/>
</Component>

warning LGHT1076 : ICE91: The file 'doc_code_file1' will be installed to the per user directory 'code_Simple'

Eventhough I addded the registry value settings. It gives the following warning
warning LGHT1076 : ICE91: The file 'doc_code_file1' will be installed to the per user directory 'code_Simple' that doesn't vary based on ALLUSERS value
. This file won't be copied to each user's profile even if a per machine installation is desired
My Code
<Component Id='doc_code_copy' Guid='DA95057C-9866-4422-B00B-105BBF862C92' Directory='code_Simple'>
<RegistryKey Root='HKCU' Key='Software\SimpleToolkit_2012\uninstall\Codesnipet'>
<RegistryValue Value='Installed code snipet in Document' Type='string' KeyPath='yes'></RegistryValue>
</RegistryKey>
<File Id='doc_code_file1' Name='doc_code_file1' DiskId='1'
Source='Personalfolder\Visual Studio 2012\Code Snippets\Visual C#\My Code Snippets\command.snippet' />
</Component>
</Directory>
How can suppress this warning ?
If you just want to suppress the warning you can add -sice:ICE91 to the light.exe command-line to prevent that particular ICE from running. Alternatively, you can add to your .wixproj a property like:
<PropertyGroup>
<SuppressIces>ICE91</SuppressIces>
</PropertyGroup>
If you are using Visual Studio to open your .wixproj files, you can set that property by going to the Project Properties on the Tool Settings tab, you can add ICE91 there.

How do you copy a set of files to multiple places using Wix?

I'm trying to make an install that puts a copy of the same files in multiple places...
is there a simple way to do this?
eg. if I wanted to put a.txt b.txt c.txt into all of the following directories :-
.\Blah\
.\Txts\
.\Examples\
Simply create multiple components which reference the same file, but install it to different locations. The only gotcha is that you cannot use two <File Source="somefile"/> elements referencing the same file because they will get the same auto-generated ID. Explicitly give the file elements different IDs to avoid that problem.
<DirectoryRef Id="directory1">
<Component Id="somefile-component1">
<File Id="somefile-id1" Source="/path/to/somefile"/>
</Component>
</DirectoryRef>
<DirectoryRef Id="directory2">
<Component Id="somefile-component2">
<File Id="somefile-id2" Source="/path/to/somefile"/>
</Component>
</DirectoryRef>
Duplicate Files: Windows Installer has its own concept for this called "DuplicateFiles". It only works if the files are actually identical, but it sounds like that's what you want.
CopyFile Element: In WIX you implement this via the CopyFile element:
http://wix.sourceforge.net/manual-wix2/wix_xsd_copyfile.htm
I haven't actually tried it, but it should look something like this
<Component Id='Manual' Guid='*' >
<File Id='Manual' Name='Manual.pdf' Source='Manual.pdf' KeyPath='yes'>
<CopyFile Id='MyDuplicateFile1' DestinationProperty ='DesktopFolder'/>
</File>
</Component>