I'm trying to set installation path manually, with these lines of code,
MSIHANDLE msiHandle;
UINT openPackageExitCode = MsiOpenPackage(LR"(path to .msi file)", &msiHandle);
LPCTSTR newPath = LR"(C:\test\)";
UINT changePathResult = MsiSetTargetPath(msiHandle, L"INSTALLDIR", newPath);
MsiCloseHandle(msiHandle);
but, I get an error which says ERROR_DIRECTORY.
How can I change the installation path with this method?
Calling
MsiSetTargetPathin a custom action afterCostFinalizeaction solved my problem.