BURN: Logging BURN_PACKAGE-> sczLogPathVariable to be used to create complete Log file - wix

I am using WIX 3.7, and I am wanting to have my MSI and BURN log files, be created at my desired location. I tried verbatim both the approaches, mentioned in How to set or get all logs in a custom bootstrapper application newsgroup post. However, Log File gets created in the default location. Since I had time on hand, I decided to explore WIX 3.7 through WIX 3.9 Source Code, attempting to find where BURN_PACKAGE-> sczLogPathVariable data member is used.
However I found just 5 references to BURN_PACKAGE-> sczLogPathVariable
\wix38-debug\src\burn\engine\logging.cpp(191):
if ((!fRollback && pPackage->sczLogPathVariable && *pPackage->sczLogPathVariable) ||
\wix38-debug\src\burn\engine\logging.cpp(197): hr = VariableSetString(pVariables, fRollback ? pPackage->sczRollbackLogPathVariable : pPackage->sczLogPathVariable, sczLogPath, FALSE);
\wix38-debug\src\burn\engine\package.cpp(152):
hr = XmlGetAttributeEx(pixnNode, L"LogPathVariable", &pPackage->sczLogPathVariable);
\wix38-debug\src\burn\engine\package.cpp(303):
ReleaseStr(pPackage->sczLogPathVariable);
\wix38-debug\src\burn\engine\package.h(165):
LPWSTR sczLogPathVariable; // name of the variable that will be set to the log path.
I was expecting some code that would actually retrieve the value of MY VARIABLE and then CONCATENATE that value with the Log File Name that was synthesized, to create the complete file path. Maybe I am missing something obvious ? Do you guys have any suggestions ?

*Package/#LogPathVariable is used to specify a variable that gets the path to the log. To control the logging, use the Log element.

Related

Jenkins. How to change file content

I've created a new project in Jenkins.
But now I want to change some information in my .properties file
How can I do that? (I've already read about Environment Injector, but I don't think, that it's what I need)
So, and one more questions - will this changes commit in file? (I don't want to do that)
Thank you!
Try using a scripted pipeline and you can use groovy for this task. For instance:
Properties props = new Properties()
File propsFile = new File(".properties")
props.load(propsFile.newDataInputStream())
props.setProperty('key', 'value')
props.store(propsFile.newWriter(), null)
You open the properties file, change the value of a specific key element and write to the same file when done.
If you are making use of Jenkins and it is on a windows machine. You can make use of PowerShell to change the file content
Here in this example,
I am actually trying to modify the string occurrence 'Memory Usage' with Jenkins build number
(Get-Content C:\proj\Jenkins\workspace\QA.I9.Api\Sample.txt).replace('Memory Usage', $env:BUILD_NUMBER) | Set-Content C:\proj\Jenkins\workspace\QA.I9.Api\Sample.txt
Thanks,
xyzcoder.github.io

Copy Files from Previous Installation

To fit Win 8 requirements, I need to copy a data file (data.mpd) from the install directory of the previous installation (typically c:\ProgramFiles but users could have changed to something else) to a new directory c:\User\....
How can I:
Get the path of the previous install
check if the file data.mpd exists
Copy that file to the C:\Users...
You might use the WizardForm.PrevAppDir property, which holds the folder path, where the installer with a certain AppId had previously installed the application (empty if it was not yet installed). Note that this property is filled after the wizard form is initialized, so read it after the InitializeWizard event.
For your task, I would do this operation at the pre-installation step, so for the CurStepChanged event method, I would write something like:
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
DataFilePath: string;
begin
// check if the current step is pre-installation step and if the
// application had been previously installed; if so, then...
if (CurStep = ssInstall) and (WizardForm.PrevAppDir <> '') then
begin
// build and store the path to the Data.mpd file from the prev.
// installation path
DataFilePath := AddBackslash(WizardForm.PrevAppDir) + 'Data.mpd';
// check, if that Data.mpd file exists; if so, then...
if FileExists(DataFilePath) then
// copy it to the target directory; if it fails, show error message
if not FileCopy(DataFilePath, <your new directory here>, False) then
MsgBox('Copying of the Data.mpd failed!', mbError, MB_OK);
end;
end;
Use DisableDirPage=auto. This will prevent people from changing the install path on an upgrade.
Then have your application (not the installer) detect this file in its own folder and copy it to the per-user folder. This will give you the most robust behaviour in case multiple users run your application (which is the whole point of having per-user data).

MsTest, DataSourceAttribute - how to get it working with a runtime generated file?

for some test I need to run a data driven test with a configuration that is generated (via reflection) in the ClassInitialize method (by using reflection). I tried out everything, but I just can not get the data source properly set up.
The test takes a list of classes in a csv file (one line per class) and then will test that the mappings to the database work out well (i.e. try to get one item from the database for every entity, which will throw an exception when the table structure does not match).
The testmethod is:
[DataSource(
"Microsoft.VisualStudio.TestTools.DataSource.CSV",
"|DataDirectory|\\EntityMappingsTests.Types.csv",
"EntityMappingsTests.Types#csv",
DataAccessMethod.Sequential)
]
[TestMethod()]
public void TestMappings () {
Obviously the file is EntityMappingsTests.Types.csv. It should be in the DataDirectory.
Now, in the Initialize method (marked with ClassInitialize) I put that together and then try to write it.
WHERE should I write it to? WHERE IS THE DataDirectory?
I tried:
File.WriteAllText(context.TestDeploymentDir + "\\EntityMappingsTests.Types.csv", types.ToString());
File.WriteAllText("EntityMappingsTests.Types.csv", types.ToString());
Both result in "the unit test adapter failed to connect to the data source or read the data". More exact:
Error details: The Microsoft Jet database engine could not find the
object 'EntityMappingsTests.Types.csv'. Make sure the object exists
and that you spell its name and the path name correctly.
So where should I put that file?
I also tried just writing it to the current directory and taking out the DataDirectory part - same result. Sadly, there is limited debugging support here.
Please use the ProcessMonitor tool from technet.microsoft.com/en-us/sysinternals/bb896645. Put a filter on MSTest.exe or the associate qtagent32.exe and find out what locations it is trying to load from and at what point in time in the test loading process. Then please provide an update on those details here .
After you add the CSV file to your VS project, you need to open the properties for it. Set the Property "Copy To Output Directory" to "Copy Always". The DataDirectory defaults to the location of the compiled executable, which runs from the output directory so it will find it there.

extra-paths not added to python path with zc.recipe.testrunner

I am trying to run tests by adding a version of tornado downloaded from github.com in the sys.path.
[tests]
recipe = zc.recipe.testrunner
extra-paths = ${buildout:directory}/parts/tornado/
defaults = ['--auto-color', '--auto-progress', '-v']
But when I run bin/tests I get the following error :
ImportError: No module named tornado
Am I not understanding how to use extra-paths ?
Martin
Have you tried looking into generated bin/tests script if it contains your path? It will tell definitely if your buildout.cfg is correct or not. Maybe problem is elsewhere. Because it seem that your code is ok.
If you happen to regularly include various branches from git/mercurial or elsewhere to buildout, you might be interested in mr.developer. mr.developer can download and add package to develop =. You wont need to set extra-path in every section.

SSIS - Skip Missing Files

I have a SSIS 2008 package that calls about 25 other SSIS packages.
Each of those child packages loads a specific file into a table. But sometimes one or more of these input files will be missing.
How can I let a child package fail (because a file is missing) but let the rest of the parent package keep on running?
I've tried increasing the maximum error count on the parent package, the tasks in the parent package that call each child, and in the child package itself. None of that seemed to make any difference. I still get this error when I run it with a file missing:
SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The
Execution method succeeded, but the
number of errors raised (2) reached
the maximum allowed (1); resulting in
failure. This occurs when the number
of errors reaches the number specified
in MaximumErrorCount. Change the
MaximumErrorCount or fix the errors.
Edit:
failpackageonfailure and faulparentonfailure are already all set to false everywhere.
I haven't tried this, but this is how I would approach it.
Create a variable for the file name and the child package name.
Use a For Each Loop container. Have it go through the location of the files and pull the file names one at a time. Use the file name to change the child package name variable. In the container have the task to run the child package and have the name dynamically set based on the values of the child package name variable.
Then it should only try to run the child packages which have appropriate files.
in the properties of the execute package task, you can set the failpackageonfailure and faulparentonfailure. i haven't worked with these, but you can probably play with them to get your desired results.
Side note: for simplicity, I'd set these settings on the parent SSIS package.
There is a MaximumErrorCount values at the Sequence Containers & package level. If you're using this be sure your values are in-sync because the package level settings take precedence.
Another option is the ForcedExecutionValue.
To set this up, load the properties tab for each of container and:
1) ForceExecutionValue to TRUE
This will cause the container to return whatever value you put in the variable (see step #2), despite the outcome of the task(s).
2) ForcedExecutionValue to 0
This acts a return value for that task, and sets it to 0 (true, think "return 0" as in C++).
I hope that helps.
This will cause the package to
Load the properties using "ForcedExecutionValue" to 0, then Then set the Force
I have done this kind of scenario development, first plan the package execution method as whenever you will get a file we need to process the package if not either fail or leave the package ultimately our target is to process all the package of files existing. take a variable for all the packages. set the variable to "Y" or "N" on the existing of the file using script component or connection string in the parent package. the existing condition to execute the package on the value of the variable.
This method gave us desired results of process multiple files with different occurences of source files.
thanks
prav