Friends How to Set This Code VS.NET Setup Conditions.
<Copy Condition="!Exists($(DestPath)database.dat)"
SourceFiles="$(SrcPath)database.dat"
DestinationFolder="$(DestPath)"/>
Source Link
You can try this approach:
go to Launch Conditions Editor in your setup project
create a new file search and configure it to find your file
remember the installer property used by this search
go to File System Editor
select your file
in its Properties pane set Condition field to the search property negated; for example, if the search property is named MY_FILE_SEARCH, the condition can be:
NOT MY_FILE_SEARCH
This way the file is installed only if the search doesn't find anything.
Related
I added a filter and some .c files to my .vcxproj through the GUI but they won't build correctly because I'm in the process of adding all the correct environment variables.
Is it possible to temporarily exclude from the build a filter and its children?
As the name says, 'filter' is just view filter and has no effect on build system, thus, there is no easy way. You can only modify project and source files properties ('Excluded from build' of cpp in your case).
But... there is a workaround, which makes you edit all cpp files only once and works for all build configurations.
Create props file (View->Other Windows -> Property manager, right mouse button on your project and 'Add new...') and in User Macros add TempExclude with value 'Yes'
Now select all problematic files and in Excluded from Build type $(TempExclude) (Don't forget to select All Configurations and All Platforms)
Now you can edit just value of TempExclude in property file to get you files in/out build. If you dont define TempExclude it will include files into build.
I am using Advanced Installer with Visual Studio 2010.
I managed to create an .aip project, but when I want to add the files from the relevant VS projects, I have to choose the exact location of these files.
I want to use more then one build configuration so I can use config transforms to change my .config files depend on the build configuration I choose.
This is a problem for me because when I compile in Debug the .exe & .dll files goes to bin\Debug, but when I compile in, lets say, Staging these files goes to bin\Staging.
How can I get Advanced Installer to get the right files, meaning get them from the target folder of the build configuration I chosen?
Advanced Installer does not support this by default, but with a little bit of tweaking you can get this working. Let me explain how:
the first requirement is to have your output folders generated by VS in the same parent folder, as you have them both placed in "bin\".
now you need to open your project in Advanced Installer GUI and do the following:
create two builds in Media page, called Debug and Staging
create a property called "Configuration" or what name would you like, from Install Parameters page
in the New Property dialog you will have options to set per-build values for your property. Set them to "Debug" and "Staging", i.e. the names of the folders created by VS
now go to File -> Options -> Path Variables and define a new path variable with your full path for the debug/staging, the one you current have in the project.
from the Home tab, in the toolbar, use the "Convert Paths" wizard and then save the project.
Now, it comes the tricky part, you will need to edit the project file in a text editor, like Notepad++, capable of saving the file in UTF-8 format. Once you open the file look for this XML node:
<COMPONENT cid="caphyon.advinst.msicomp.AppPathsComponent">
<ROW Name="BIN_DIR" Path="<your path>\bin\Debug" Type="2" Content="0"/>
You might have multiple variables here if you are already using this feature. You need to edit the value and replace "Debug" with "[|Configuration]".
Now you can save and build the project and it should pickup the correct files for each of the two builds.
So I have a VS2010 project which contains a folder called "Levels" with "Level1.xml", "Level2.xml", etc. I have a custom build tool I want to run on these XML files, and so far, I've been individually modifying the properties of each file in VS2010, setting the Configuration Properties > Item Type to "Custom Build Tool", and then copy-pasting the exact same values into the "Command Line" / "Description" / "Outputs" parameters in the custom build tool property page.
This is, of course, a terrible practice.
I believe that adding a new Target to the .vcxproj should help, according to http://msdn.microsoft.com/en-us/library/ms366724.aspx , but I've found absolutely no way to say "Run the following step on all items that match these given rules". How can I solve this?
I have a set of text files that I need to have a test take in and use the items for specific parts of some Unit tests I am writing. I have put a file path in my app.config of just: .\DataLists\
After I put that in there I added the items needed to add a custom section so it would then get that file path information. The problem I am having is this...it is not finding those lists in that location it is looking at some tmp folder instead. How do I specify a proper file location for this?
Have you tried using the DeploymentItemAttribute? link Use this on the test method(s) where you need access to your 'set' (folder I assume) of text files. The best practice here is to add the folder and files you want deployed to your project file and set them to 'Copy if newer' or 'Copy Always'.
You can also add the file(s) or folder to the Deployment section of the .testsettings configuration screen. In my experience this works better during Team Builds than the DeploymentItemAttribute route. In either case the 'Enable deployment' check box found in the .testsettings config screen must be checked.
I have a VS 2008 Setup project. I only want to install an XML file if it does not already exist on the target system. The installer overwrite rules for non versioned files ensure that a file will never be overwritten if it has not been modified on the target system. But I want to never overwrite the file. There is a Condition property that can be set on a file in the Visual Studio installer properties for a file. What is the correct syntax for the Condition property to check for existence of file and only install if it is not there?
You will need to go to the Launch Conditions tab and search the target computer for the file you want to check for. The launch condition will let you specify the name of a property it will set to the path of the file if it exists, otherwise it will be empty. You can now use this property as the condition on your file.
I was able to use a launch condition to set a property, and use this for a conditional install of a file, so I will mark 'heavyd' as the correct answer. However, was not able to use the file search effectively, as was suggested (see comments on the answer). Instead, I used a Windows Installer Search (one of the three types of searches available in a VS 2008 Setup Project) with the MSI ComponentID, as follows (I found the technique here):
Product 1 is installed and has a file named MyFile.txt.
You use ORCA (from the Windows Installer SDK) to view the File table, and find the row that represents MyFile.txt.
You get the value of the Component_ column and then open the Component Table.
In the Component Table you find the row that has the Component_ value in the Component column, and get the ComponentID. Copy this value into clipboard. Close ORCA.
In your setup project, open the Launch Conditions Editor and add a Windows Installer Component Search. For the ComponentID property of the new search, paste the ComponentID.
Copy the Property property. It should be something like COMPONENTEXISTS1.
Open the File System Editor and select the Application Folder, then select the file you want to conditionally install.
Edit the Condition property to be COMPONENTEXISTS1 = FALSE.
Set the Transitive property to true if you want the condition to be evaluated each time the installer is run (not just the first time).
Now, MyFile.txt will only be installed if it is not already there.
There is one caveat with this technique: Doing a repair on the installation will cause the file to be deleted, even though the file is marked as Permanent! Not good. I worked around this by adding some custom actions (calling vbscript files) to backup and restore my file.
What a hassle to just achieve so simple a task: install a file once on initial install, then, never again overwrite it.
If anyone has a better solution, I am all ears.