setup wizard silent argument - silent-installer

I have a solution that contains a setup project(made with VS2008 setup wizard). I need to have the option to silently install the setup project. I read that in order to do this, I should delete the User Interface screens. But this will make my setup project ONLY silent. I need it to be available to be used normally (non-silent), and when called with a specific argument, to be silent.
So my 2 questions:
How can I pass arguments to the setup project?
How can I create a silent install procedure, while also keeping the normal setup, when the project is called with no argument?
If there are resources on the web, please point me to them.

Setup exe can usually be run in silent mode using:
setup.exe /q
MSI can be run in silent mode using:
msiexec /qn /i setup.msi

Related

Ctrl-r do not run when the build directory has been changed

By default the build directory of a project is a sibling, withing the same directory than the project himself.
To have a better organisation in my backup process, I have moved the defaut build path in a directory which is sibling of the parent directory of all my projects. The compilation default path has been updated accordingly.
Now I only backup my projects, without the builds.
The problem I'm facing now is about the execute key combo Ctrl-r for which I get the compilation progress bar, but in fact, the project is not compiled now. This is confirmed because the compiled files do not update within the buid directory.
The only way, now, to update compilation is through the menu Build-> build all. It works but without key binding and I need after to execute.
Is there a way to recover Ctrl-r when changing the build directory path ?
Thanks for help
When you run a project from Qt Creator, it gets rebuilt only if needed, as clearly stated here:
Run configurations start the application in the location where it was
copied by the deploy configuration. By default, when you select the
Run function, Qt Creator builds the project, deploys it to the device
defined in the kit, and runs it there. However, if you have not made
any changes to the project since you last built and deployed it, Qt
Creator simply runs it again.
The only way to force build is to issue the rebuild command explicitely (you can use the Ctrl-B shortcut for that purpose).
If the default build directory is changed (in Tools>Options>Build & Run>General) this setting will apply (as a default) for subsequently created projects. Existing projects will keep their build directory, as specified in the project Build Settings.
You may also want to check if the options
Always build project before deploying it
Always deploy project before running it
in Tools>Options>Build & Run>General are set.
Sometimes, editing a header file does not trigger a build, even if the file is included in some cpp file. To solve this issue in Qt Creator, just add a line like this to the pro file:
DEPENDPATH += path/to/the/header(s)

Build directory for Qt Creator IDE

I am trying to populate a QTableview with some data. When developing under Qt Creator, data is read from build directory. Running the program each time, the QTableview keeps getting repopulated with previous data.
If I manually change the build directory each time before run, doesn't happen. But how do I solve the problem without manually changing the build directory every time I want a fresh run?
In your project directory there is a file name ProjectName.pro.user.
This file creating when you configure your project. it's XML file.
you can find this line on *.user files:
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/probook/Documents/Qt/testProject/Build/Windows/Debug</value>
This line define build directory address for debug. there is a same line for Release and Profile in that file.
You can also use Qt creator to define(customize) relative directory build:
goto Qt creator, Tools, Options..., Build & Run, General, Default build directory.
More info:
Qt Creator stores user-specific project settings in a .pro.user file. You can share these settings between several projects as a .pro.shared file. It has the same XML structure as a .pro.user file, but only contains the settings to share.
Based on comment, issue seems to be data which gets saved to build directory. And solution would be to remove it before running the application.
You can add Custom Process Step, either under Projects - Build Settings -
Build Steps, or under Projects - Run Settings - Deployment, and just delete the desired data files. Exact command depends on operating system.
An alternative might be to add a command line switch, something like --development-erase-saved-data, to the application itself, and erase the files (or just not read them, or whatever). Then add that command line switch to Projects - Run Settings - Run Steps - Command Line Arguments for desired build configurations.
Adding support for this in the application itself is easier to maintain, and is almost automatically cross-platform. However, it might be a feature you don't want in the application, though in that case you might only enable it for Debug builds (with #ifdef).
As a side note, saving data to executable directory is not a good idea these days. You might want to save it for example to location returned by
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
(See here for more info.)

Precompiling and Deploying website from Visual Studio Team Services

We're using Visual Studio Team Services with Git as the source control system and I've configured a build which executes successfully online. Ideally I'd like to:
After building the site in VSO, precompile and dump the aspx and .dll files to the git repository
On the on-premises web server, pull from git and move to our staging site
The second part I can figure out on my own, but the documentation for VSTeam seems sketchy on how to dump the compiled sources to git. I've kept the default build configration almost the same as the default with the exception of a Powershell script which is supposed to create artifacts for the drop. Despite this, the drop.zip file create is empty.
The following is how my build definition is set up in VSO.
Instead of the PowerShell script, you'd be able to use the "Copy and Publish artefacts" and have it create a specific artefact with the specific bits you need:
This will automatically create a named build artefact which you can then use from Release Management as an input.
The PowerShell script was used in the XAML builds when used with the "Project Output | As Configured" option.
To create your "packaged" website, you need to add a couple of parameters to the MsBuild/Visual Studio Build step to instrict the compiler to package your website:
/p:DeployOnBuild=true /p:DeployTarget=Package
/p:SkipInvalidConfigurations=true /p:PackageAsSingleFile=false
/p:AspNetCompileMerge=true
Optionally you can configure your target directory as well using
/p:PackageLocation="$(Build.BinariesDirectory)\Published"
If you do this, you need to configure this directory as your copy root in the copy and publish task.
I did a quick look at the Power-Shell script, there are two issues with it:
It still use the variables like "$Env:TF_BUILD_SOURCESDIRECTORY" which does not exist in VSTS(VSO). See Variables for VSTS.
It copies the files from "BUILD_SOURCESDIRECTORY" folder to "BUILD_BINARIESDIRECTORY". But the "Publish Build Artifacts" step in your definition publish the files in "BUILD_ARTIFACTSTAGINGDIRECTORY" folder.
So if you want to use this script, you need to update the script to remove the "TF_" string in the variables and update the "Publish Build Artifacts" step to publish the files in "BUILD_BINARIESDIRECTORY" folder(Set Path to Publish to: $(Build.BinariesDirectory)).
However, if you want to copy and publish the website files, you can simply add one more argument in "MSBuild Arguments" section of "Visual Studio Build" step:
"/p:outdir=$(build.artifactstagingdirectory)"
Remove the Power-Shell script step and the other steps just keep default settings.
Or you can also change the settings of "Copy Files" steps to select the files/folders you'd like to copy.

OpenCover in localhost with C# MVC 4 app

I just want to try OpenCover to get Coverage statistics from my app.
But I don't understand well how to use it. So here my questions?
Does the dll's have to be in the same directory? (my solutions have several projects)
Any example to get Coverage using OpenCover?
Is necessary to run the site in IIS Express or with ASP.NET development server is ok?
Thanks a lot!
I set up open cover as an external tool to make it easier on me.
Download the exe and drop it in a folder with as short a path as possible. then setup and external tool as follows:
Title : Open Cover {this is your choice}
Command: {your path to opencover}\OpenCover.Console.exe
Arguments: -register:user -target:"C:\Progra~1\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" -targetargs:"$(TargetName)$(TargetExt)" -output:coverage.xml -targetdir:"$(ProjectDir)\bin\debug"
Initial directory: $(TargetDir)
Set it to use output window and close on exit. You will need to adjust the test runner program to suit you, i use vs2012, if you do too, that will make it easier on you.
To use it, click your test project in your solution explorer, then click on the open cover external tool and it will generate you the coverage report. I use it with Report Generator.
Set it up as an external tool too:
Title: Report Generator
Command: {Your path to report generator}\ReportGenerator.exe
Arguments: $(TargetDir)coverage.xml $(TargetDir)\coverageResults
Again, set to close on exit and use output window.
after generating your coverage report, you can then use report generator to create a nice looking html version that you can click through and see the stats.
hth
The docs that are installed alongside OpenCover carry a lot of useful information about running OpenCover. You should have a copy of this file https://github.com/sawilde/opencover/blob/master/main/OpenCover.Documentation/Usage.pdf in you download package (MSI/ZIP/NUGET)
The DLLs do not need to all be in the same directory but you will normally find that this happens due to the build process. Any assemblies that you want to gather coverage from will require that the PDBs for those assemblies to be in the same directory as the assembly or in the folder referenced by targetdir switch.
Yes you can use it to run iisexpress or the ASP.NET development server use the target switch.

How to preserve existing files and folders on site update?

I'm using Microsoft Web Deploy to publish and update my site. (script is generated with Visual Studio). This tool removes auto-generated files and folders on update, as they are not included into install package. How to make it keep these files?
The Web Deploy command line tool has two switches that may be useful: -skip and -enableRule:DoNotDeleteRule. For information on -skip, see Web Deploy Operation Settings, and for DoNotDeleteRule, see Web Deploy Rules.
In Visual Studio, you may be able to tweak the deploy.cmd file to use these to achieve what you want. For more information, see How to: Install a Deployment Package Using the deploy.cmd File.
Having to edit the deploy.cmd files each time you generate them is a pain. I am using VS2017 and found I can set an environment variable on the server and deploy.cmd will use it. The deploy readme file says it:
Alternatively, you can specify additional flags by setting the
"_MsDeployAdditionalFlags" environment variable. These settings are
used by this batch file.
So on the server I created the environment variable:
_MsDeployAdditionalFlags=-enableRule:DoNotDeleteRule
And that did it. It now adds the rule each deploy on the server.

Resources