VS2013 Installer Project - install file that will not be permanent - visual-studio-2013

I am using a Visual Studio 2013 Installer Project to install/update my C++ app. In order to update the client database I am installing the new master database under a temporary name. When my app starts it checks to see if the temp file is there - if present it runs the db update function and removes the temporary when done. The problem - when my app is then started, the user gets "Windows is configuring ... " because the temp database file that was installed is now missing. There is no property to control this in the VS installer project. In Orca I have found the row in the FeatureComponents table that sets DefaultFeature for this file. The event list tells me it is DefaultFeature on this file that triggers the behaviour. If I remove that table row in Orca, the file doesn't get installed. Does anyone know the correct method for me to use to install a file that I can subsequently delete without any consequence?

The official way to do this has no support in VS setup projects. You need to set the component id to null for the file you are going to remove after the install, see the ComponentId column:
https://msdn.microsoft.com/en-us/library/aa368007(v=vs.85).aspx
so you'd need to edit the MSI file with Orca to set that guid column to empty for that file. If you look at the Component column (starts with C_) you'll see that in the Component_ column of the file table, that should help you you find it.
Other methods are unreliable (because, for example, there are other ways a repair can start and attempt to restore the file).

Related

SSIS 2005 how to resolve the error "input column has lineage id that was not previously used in the data flow task" programmatically

I'm trying to write a program that automatically add columns from the OLE DB Sources in all of the components in a .dtsx file (the target is SSIS 2005). When I process the .dtsx with my program seems that the columns are added correctly, but when I open the modified package, in the components appears this message:
input column has lineage id that was not previously used in the data flow task.
If I double click on the component and then I press OK the error disappear.
My question is:
is there a way to have the same behavior programmatically? I'll try to automate this operation for the user by using this program but with this error block me in the project.
i had this problem, i could resolve that by bellow solution but i know it's not useful solution.
meta data can not detect your changes , you can delete your task and create again that task.
Both source and destination column must have the same linage id.

SDF file always being created as read only after installation on Windows Mobile

My windows mobile app has a local database file (database.sdf). The file that is created when the user installs the CAB file in their device. The installation works fine but when I try to open the SDF with Query Analyzer or when the app tries to access the database I get a message.
"Access to the database file is not allowed" (25039)
When I checked the permissions using Windows Explorer (the device is docked), the file is marked Read Only. If remove the Read Only checkbox everything works fine, I can open, edit and add records to the database.
How I can make the file not Read Only by default?
You could verify the attribute programmatically during start-up of your application. In C#/.netcf it would be:
if (File.GetAttributes(path) & FileAttributes.ReadOnly == FileAttributes.ReadOnly)
File.SetAttributes(path, File.GetAttributes(path) & ~FileAttributes.ReadOnly);
In addition to the answer provided by yms, I would try to figure out why the file is being created as ready-only in the first place.
Is it created via some custom installer dll you added to the installation process? Or is it packaged up into the .CAB file via cabwiz or an installer project in VS?
If it's the former, check the source code of that installer library.
If it's the latter, check the source files. If you include the SDF in your Visual Studio project and have the project checked into some type of source control, it's likely that while it's checked into the source repository it's read-only on disk when it get's packaged up into the .CAB.
I know this is old, but if Andrew is actually using the .netcf, it doesn't have File.GetAttributes. Instead he should use
FileInfo info = new FileInfo(pathToFile)
if ((info.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
info.Attributes &=~ FileAttributes.ReadOnly;

Visual Studio Installer: How to make app.config a hidden file if I choose to add primary output instead of individual files?

Basically, I created a Visual Studio Installer project. I added a primary output to my project, which was great because it loaded in the dependencies and files automatically for me. The problem I'm facing is that I want to be able to mark my config file as a hidden file, but can't seem to figure out how.
When I go to View>File System it lists:
MyExternalAssembly.dll
Primary output from MyProject (Active)
So, is there a way to actually mark my config file as hidden during installation if I add a primary output project instead of the individual files?
I'm not sure if you really want to make it hidden. If you're worried about users looking at it, a more than average user will know how to un-hide things and pilfer around. So, that being said, if you want to keep users from seeing what's in the config you will need to encrypt the config. A good example of that can be found here:
http://www.davidhayden.com/blog/dave/archive/2005/11/17/2572.aspx
If you still want to hide the config, then you could try hiding it once the application is run for the first time.
Using: ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.IsFirstRun with a click once application you can tell if this is the first time an application is run.
You could then use File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden); to actually hide the app.config.
Which would result in:
if (ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.IsFirstRun)
{
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);
}

VS2005 Setup project - program asks for installation media when started for the first time by another user

I have a very simple VS2005 deployment project that aims to install for all users on a PC.
All the application files are written to %Program Files%\MyProg. A shortcut is created in the start menu and the startup folder. No registry settings or anything else are created. I have set
'InstallAllUsers' to true.
The created MSI runs fine and installs the software. It works without any problems when running under the user account from which it was installed.
When logging in as another user, the start menu and startup icons are present. It attempts to launch the application however an installation window pops up and states that 'the feature you are trying to use is on a network resource that is unavailable.' The installer will only proceed if pointed to the original MSI file.
Why does this happen? I want my application to be installed completely for all users when it is installed by a single user.
edit: Solution
I was getting similar event log messages as shown on this page. In my case it turned out to be as simple as ensuring that the User's Program Menu had its 'AlwaysCreate' attribute turned to false. If it was true, windows would try and recreate the folder when a new user logged in. This somehow required the invocation of the installer and thus resulted in the 'please insert the installation media' prompts.
It is actually kind of hard to say without some more information. I would recommend checking on the rights in the installed folder (seeing if only the one who installed it has rights) and also checking the file list for the directory (to make sure VS didn't automatically place some files in the user profile). Let me know what comes out from those two steps and we can try to keep digging if that didn't shed any light on it.
Keep in mind chances are this is most def not specific to Visual Studio, look at this MS support article here where the same message is coming back for office.
I know this is an old post but I thought I'd add another cause and solution in case the above didn't work for you.
There is a bug in VS Setup and Deployment Projects which results in registry values being entered into HKCU instead of HKLM irrespective of the InstallAllUsers property being set to true.
You must use Orca msi editor to change the registry root for "DesktopFolder" and "ProgramMenuFolder" from either 1 or 2 to -1. The issue cannot be resolved via VS.
http://www.qa.downappz.com/questions/vs-2010-deploys-per-user-features-during-install-which-require-access-to-install-media.html

How to show files being copied, moved,etc. on installer screen using WIX

I have my installer and is working fine.
What I want to add more is that I want to show the work done by installer on installer screen (Example, installing Microsoft SQL Server 2005, we get the files being copied, moved, registry entry created,......)
Similarly I want to show this on my installer.
So can anyone help me on this to how to show all these at runtime on installer screen.
Thanks,
Sunil
Just copying my answer to the same question on wix-users list:
Use ProgressText element.
The 'Template' attribute is the place to put tokens to reflect the progress. See the standard InstallFiles action for example.
The table "ActionData messages" lists the possible tokens for this action.
Sample:
<ProgressText Action="InstallFiles" Template="File: [9][1]">!(loc.InstallFilesActionText)</ProgressText>
Outputs:
File: C:\Program Files\MyApp\bin\my.dll
etc.
Hope this helps,

Resources