I use wix to generate a windows installer. And in wxs file after RegistrySearch I got file path C:\xx\xx\xx.exe and there are no keys in RegistrySearch to return directory path C:\xx\xx. Is there any wix ways to get C:\xx\xx from C:\xx\xx\xx.exe.
Related
I am trying to understand how Visual Studio treats paths when they are being run from inside the IDE vs manually opening the executable file from bin. I have two projects that are linked together:
/demos
/basic-triangle
/src/...
/engine
/src/...
/workspace
/MyEngine.sln
/engine
/bin/Debug/assets
/bin/Debug/engine.lib
/engine.vcxproj
/demos/basic-triangle
/bin/Debug/basic-triangle.exe
/basic-triangle.vcsproj
-> references engine.vsxproj
So, in basic-triangle application, I have set up the following path:
Engine::setAssetsPath(
std::filesystem::path("../../../../engine/bin/Debug/assets").string());
This resolves to /engine/bin/Debug/assets, which looks like the path is counted from bin directory instead of bin/Debug directory. However, when I open the executable, the path is calculated from bin/Debug. How can I normalize this so Visual Studio uses the same current working directory as opening the executable file.
What is the difference of the working directory vs the output path in visual studio?
Is it bad to set both setting to the same directory like '....\bin\'
By default they are the same. Assuming you're debugging some application it will be bin\debug.
Output Directory is where your output files goes. By default, Visual Studio builds each project in a solution in its own folder inside the solution. You can change the build output paths of your projects to force all outputs to be placed in the same folder
Working Directory is the location which Specifies the working directory of the program being debugged. It is the default place in which a program is looking up it's files. Normally the working directory is the directory the application is launched from \bin\debug by default.
So every opened file will be opened relative to the working folder.Let's say if you have an application installed in c:\myapp with all lib files in the same directory then you will set your working directory to myapp folder and you can do so from project properties.
By default, working directory is the output directory. Both can be changed, you can set another directory or common directory for all projects for output directory that determines a relative path for the output file that might be an executable or a static library.
Working directory also provides a relative path to put files that are used by the program. You can put a log file into a place that you can use its directory as a relative path in the code instead of absolute path. If your working directory is myproject\src and your log file is in myproject\src\log\log.txt then you can open or write the log file with log\log.txt in the code rather than c:\blabla\myproject\src\log\log.txt.
How can I to include all files from source folder and deploy them into a target folder during installation. I have multiple images in a folder and i want all of them to be included in msi automatically rather than including all of them separately using <File> element.
You need to Read about HEAT in the wix installer tutorial,
http://wix.tramontana.co.hu/
"%WIX%\bin\heat.exe" dir "$(SolutionDir)bin\Release -out Release.wxs"
this is the type of pre-build event you will need to define in order to harvest a directory.
I am creating a InstallScript project in installshield 2011 and my problem is
I want to know the path of the setup from where it is executing
Suppose there is a folder name "project_setup" in which setup.exe and abc.txt file exist.Now at run time I want to copy abc.txt file and paste it to where the setup is installed.
EDIT:
Now I am able to copy the file but In my Release folder there are 2 setups
In Disk Image/Disk1 folder (This setup Copy&Paste the .txt file and execute fine)
other is in the Package folder (This setup dont Copy&Paste but execute fine)
So how to make setup in Single exe so that it execute as well as copy&paste .txt file also.
CopyFile(SRCDIR ^ "abc.txt", TARGETDIR ^ "abc.txt");
I am getting "dll not found:restarting the application may fix the problem" error when i try to execute a simple "HelloWorld" win32 console application.
I know the location of the .dll.
How to specify its location when executing the .exe from command prompt?
PS: copying the .dll to the .exe's current dir seems to solve the problem, but this approach is not suitable in this case.
DLL loading happens deep in the plumbing of windows.
If the DLL is not found in the same directory as the application, the PATH is automatically scanned in order to find the directory.
So, the simplest answer to your problem is to add the directory containing the DLL to your PATH. Depending on when the DLL needs to be loaded by your code, you may be able to (temporarily) modify the PATH from inside your "HelloWorld" application.
The documentation for LoadLibraryEx has some discussion on how Windows searches for your dll. You might try using the LOAD_WITH_ALTERED_SEARCH_PATH flag if you can construct a full path to your DLL or use the SetDllDirectory function to add a directory to the search path.
To manually, permanently add your path to Windows PATH (permanently = until you remove it), right click My Computer>Properties>Advanced>Environment Variables>System Variables>Path>Edit>Variable Value, add a semicolon (which means "in addition to all before") and paste the full path of your dll.
Windows will search the path every time it can't find something in the current directory.
From: http://msdn.microsoft.com/en-us/library/7d83bc18.aspx
With both implicit and explicit linking, Windows first searches for
"known DLLs", such as Kernel32.dll and User32.dll. Windows then
searches for the DLLs in the following sequence:
The directory where the executable module for the current process is located.
The current directory.
The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
The directories listed in the PATH environment variable.