Re: [WiX-users] verify file existance custom action
No, you'll need to link in with the msi.lib. At the beginning of your cpp file, add the following: #pragma comment(lib,"msi.lib") #pragma comment(lib,"shlwapi.lib") That should work. Those functions that it is trying to call need to be linked in from the libraries that house them. On 3/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Ok, I finally have access to the machine I need and I'm trying this out. I tried to build in Visual Studio 03 as a C++ project, and right off the bat I got some build errors that I don't understand. I'm sure they're pretty typical, I'm just unfamiliar with VC++. error LNK2001: unresolved external symbol "unsigned int __stdcall MsiSetPropertyA(unsigned long,char const *,char const *)" (?MsiSetPropertyA@@[EMAIL PROTECTED]) error LNK2001: unresolved external symbol "int __stdcall PathFileExistsA(char const *)" (?PathFileExistsA@@[EMAIL PROTECTED]) error LNK2001: unresolved external symbol "unsigned int __stdcall MsiGetPropertyA(unsigned long,char const *,char *,unsigned long *)" (?MsiGetPropertyA@@[EMAIL PROTECTED]) I'd guess it must be something with my setup, because I get the same errors about the Set and Get methods when I use the tiny CheckPID example from http://www.tramontana.co.hu/wix/lesson3.php#3.3 I know not really a WiX issue, but I'd appreciate any advise you had. -- *From:* Levi Wilson [mailto:[EMAIL PROTECTED] *Sent:* Friday, March 16, 2007 8:56 AM *To:* Rowland, Chris *Cc:* wix-users@lists.sourceforge.net *Subject:* Re: [WiX-users] verify file existance custom action Sorry, prematurely sent it. Here is what I was getting at: extern "C" UINT __stdcall LocateFile(MSIHANDLE hInstall) { char* pDirPath = NULL; DWORD dw = 0; if( ERROR_MORE_DATA!=MsiGetProperty(hInstall,"MYFOLDER",NULL,&dw) ) return ERROR_INSTALL_FAILURE; dw += strlen("requiredfile.txt") + 1 /* term. NULL */; pDirPath = new char[dw]; pDirPath[0] = '\0'; if( ERROR_SUCCESS!=MsiGetProperty(hInstall,"MYFOLDER",pDirPath,&dw) ) { delete[] pDirPath; return ERROR_INSTALL_FAILURE; } _ASSERTE( 0!=strlen(pDirPath) ); if( PathFileExists(pDirPath) ) { MsiSetProperty(hInstall,"MYFILEEXISTS",pDirPath); // Dr. Evil assumption } delete[] pDirPath; return ERROR_SUCCESS; } I believe that something like this would work. On 3/16/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: If I look at the log after a completed installation, I can see the following property values. Property(S): MYFOLDER = C:\FTP\#This is the folder I selected in the dialog … Property(S): MYFILEEXISTS = C:\requiredfile.txt #this is where the file was found (MYFOLDER was initialized to 'c:\') So MYFOLDER did get set, but it seems to happen after the directory search took place. Would it be possible to have AppSearch happen sometime in the UI sequence, or would that break something else? It looks like by default It happens very early on. ------------------ *From:* Levi Wilson [mailto:[EMAIL PROTECTED] *Sent:* Thursday, March 15, 2007 4:36 PM *To:* Rowland, Chris *Cc:* wix-users@lists.sourceforge.net *Subject:* Re: [WiX-users] verify file existance custom action Hmmm, I've never used a directory search like that. So you're saying that your MYFOLDER property isn't getting set when the directory search is performed? I think you probably *will* need to maybe use a custom action then since I don't think you can dynamically manipulate a directory search, or tell it when to perform it as I think file searches get executed during the AppSearch sequence? I could be wrong, but I don't think you can use the FileSearch like this. On 3/15/07, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: That actually looks like exactly what I want… much cleaner than my C++ hackjob. That gives me a followup question, however. I plugged your suggestion (with Depth="0") into my dialog I use to browse to the directory that contains the file. It appears that the property I'm trying to set to the browsed-to directory doesn't contain the browsed-to directory when the DirectorySearch is performed. NOT MYFILEEXISTS MYFILEEXISTS I initialized MYFOLDER with This works if requiredfile.txt is in c:\ (I can see MYFILEEXISTS=c:\requiredfile.txt in the log) It doesn't work if I browse to the directory that contains the file (and of course I remove the file from c:\ ) Thanks for the help so far, this feels like a much better way than what I was previously attempting. -
Re: [WiX-users] verify file existance custom action
Ok, I finally have access to the machine I need and I'm trying this out. I tried to build in Visual Studio 03 as a C++ project, and right off the bat I got some build errors that I don't understand. I'm sure they're pretty typical, I'm just unfamiliar with VC++. error LNK2001: unresolved external symbol "unsigned int __stdcall MsiSetPropertyA(unsigned long,char const *,char const *)" (?MsiSetPropertyA@@[EMAIL PROTECTED]) error LNK2001: unresolved external symbol "int __stdcall PathFileExistsA(char const *)" (?PathFileExistsA@@[EMAIL PROTECTED]) error LNK2001: unresolved external symbol "unsigned int __stdcall MsiGetPropertyA(unsigned long,char const *,char *,unsigned long *)" (?MsiGetPropertyA@@[EMAIL PROTECTED]) I'd guess it must be something with my setup, because I get the same errors about the Set and Get methods when I use the tiny CheckPID example from http://www.tramontana.co.hu/wix/lesson3.php#3.3 I know not really a WiX issue, but I'd appreciate any advise you had. From: Levi Wilson [mailto:[EMAIL PROTECTED] Sent: Friday, March 16, 2007 8:56 AM To: Rowland, Chris Cc: wix-users@lists.sourceforge.net Subject: Re: [WiX-users] verify file existance custom action Sorry, prematurely sent it. Here is what I was getting at: extern "C" UINT __stdcall LocateFile(MSIHANDLE hInstall) { char* pDirPath = NULL; DWORD dw = 0; if( ERROR_MORE_DATA!=MsiGetProperty(hInstall,"MYFOLDER",NULL,&dw) ) return ERROR_INSTALL_FAILURE; dw += strlen("requiredfile.txt") + 1 /* term. NULL */; pDirPath = new char[dw]; pDirPath[0] = '\0'; if( ERROR_SUCCESS!=MsiGetProperty(hInstall,"MYFOLDER",pDirPath,&dw) ) { delete[] pDirPath; return ERROR_INSTALL_FAILURE; } _ASSERTE( 0!=strlen(pDirPath) ); if( PathFileExists(pDirPath) ) { MsiSetProperty(hInstall,"MYFILEEXISTS",pDirPath); // Dr. Evil assumption } delete[] pDirPath; return ERROR_SUCCESS; } I believe that something like this would work. On 3/16/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: If I look at the log after a completed installation, I can see the following property values. Property(S): MYFOLDER = C:\FTP\#This is the folder I selected in the dialog ... Property(S): MYFILEEXISTS = C:\requiredfile.txt #this is where the file was found (MYFOLDER was initialized to 'c:\') So MYFOLDER did get set, but it seems to happen after the directory search took place. Would it be possible to have AppSearch happen sometime in the UI sequence, or would that break something else? It looks like by default It happens very early on. From: Levi Wilson [mailto:[EMAIL PROTECTED] Sent: Thursday, March 15, 2007 4:36 PM To: Rowland, Chris Cc: wix-users@lists.sourceforge.net Subject: Re: [WiX-users] verify file existance custom action Hmmm, I've never used a directory search like that. So you're saying that your MYFOLDER property isn't getting set when the directory search is performed? I think you probably will need to maybe use a custom action then since I don't think you can dynamically manipulate a directory search, or tell it when to perform it as I think file searches get executed during the AppSearch sequence? I could be wrong, but I don't think you can use the FileSearch like this. On 3/15/07, [EMAIL PROTECTED] < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: That actually looks like exactly what I want... much cleaner than my C++ hackjob. That gives me a followup question, however. I plugged your suggestion (with Depth="0") into my dialog I use to browse to the directory that contains the file. It appears that the property I'm trying to set to the browsed-to directory doesn't contain the browsed-to directory when the DirectorySearch is performed. NOT MYFILEEXISTS MYFILEEXISTS I initialized MYFOLDER with This works if requiredfile.txt is in c:\ (I can see MYFILEEXISTS=c:\requiredfile.txt in the log) It doesn't work if I browse to the directory that contains the file (and of course I remove the file from c:\ ) Thanks for the help so far, this feels like a much better way than what I was previously attempting. ________ From: Levi Wilson [mailto: [EMAIL PROTECTED] Sent: Thursday, March 15, 2007 3:50 PM To: Rowland, Chris Cc: wix-users@lists.sourceforge.net Subject: Re: [WiX-users] verify file existance custom action Can you post your CA C++ code? Also, you don't need to have a DLL custom action to check for the existence
Re: [WiX-users] verify file existance custom action
Thanks Levi, I'll give that a shot as soon as I get access to my development box back. From: Levi Wilson [mailto:[EMAIL PROTECTED] Sent: Friday, March 16, 2007 8:56 AM To: Rowland, Chris Cc: wix-users@lists.sourceforge.net Subject: Re: [WiX-users] verify file existance custom action Sorry, prematurely sent it. Here is what I was getting at: extern "C" UINT __stdcall LocateFile(MSIHANDLE hInstall) { char* pDirPath = NULL; DWORD dw = 0; if( ERROR_MORE_DATA!=MsiGetProperty(hInstall,"MYFOLDER",NULL,&dw) ) return ERROR_INSTALL_FAILURE; dw += strlen("requiredfile.txt") + 1 /* term. NULL */; pDirPath = new char[dw]; pDirPath[0] = '\0'; if( ERROR_SUCCESS!=MsiGetProperty(hInstall,"MYFOLDER",pDirPath,&dw) ) { delete[] pDirPath; return ERROR_INSTALL_FAILURE; } _ASSERTE( 0!=strlen(pDirPath) ); if( PathFileExists(pDirPath) ) { MsiSetProperty(hInstall,"MYFILEEXISTS",pDirPath); // Dr. Evil assumption } delete[] pDirPath; return ERROR_SUCCESS; } I believe that something like this would work. On 3/16/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: If I look at the log after a completed installation, I can see the following property values. Property(S): MYFOLDER = C:\FTP\#This is the folder I selected in the dialog ... Property(S): MYFILEEXISTS = C:\requiredfile.txt #this is where the file was found (MYFOLDER was initialized to 'c:\') So MYFOLDER did get set, but it seems to happen after the directory search took place. Would it be possible to have AppSearch happen sometime in the UI sequence, or would that break something else? It looks like by default It happens very early on. From: Levi Wilson [mailto:[EMAIL PROTECTED] Sent: Thursday, March 15, 2007 4:36 PM To: Rowland, Chris Cc: wix-users@lists.sourceforge.net Subject: Re: [WiX-users] verify file existance custom action Hmmm, I've never used a directory search like that. So you're saying that your MYFOLDER property isn't getting set when the directory search is performed? I think you probably will need to maybe use a custom action then since I don't think you can dynamically manipulate a directory search, or tell it when to perform it as I think file searches get executed during the AppSearch sequence? I could be wrong, but I don't think you can use the FileSearch like this. On 3/15/07, [EMAIL PROTECTED] < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: That actually looks like exactly what I want... much cleaner than my C++ hackjob. That gives me a followup question, however. I plugged your suggestion (with Depth="0") into my dialog I use to browse to the directory that contains the file. It appears that the property I'm trying to set to the browsed-to directory doesn't contain the browsed-to directory when the DirectorySearch is performed. NOT MYFILEEXISTS MYFILEEXISTS I initialized MYFOLDER with This works if requiredfile.txt is in c:\ (I can see MYFILEEXISTS=c:\requiredfile.txt in the log) It doesn't work if I browse to the directory that contains the file (and of course I remove the file from c:\ ) Thanks for the help so far, this feels like a much better way than what I was previously attempting. From: Levi Wilson [mailto: [EMAIL PROTECTED] Sent: Thursday, March 15, 2007 3:50 PM To: Rowland, Chris Cc: wix-users@lists.sourceforge.net Subject: Re: [WiX-users] verify file existance custom action Can you post your CA C++ code? Also, you don't need to have a DLL custom action to check for the existence of a file. You can do something like this in your WiX source: If the file has been found, then the MyFileExists property will be set to the full path of your file. Is this what you're looking for? On 3/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I read that "managed code" in a custom action is a no-no (please forgive me if I use the wrong terminology) so I am attempting to write my custom action without using managed code. Most examples I find seem to use it, however, so I'm doing the best I can. I wrote a simple VC++ app (.exe) that will determine if some files exist. I probably did it badly, but it worked in that context. I took the same code, and cut& paste into a VC++ file I had setup to create my dll. The code was previously a working snippet that would simply set a msi property to "true" and return ERROR_SUCCESS. I am now trying to make it do something useful. After the cut&
Re: [WiX-users] verify file existance custom action
Sorry, prematurely sent it. Here is what I was getting at: extern "C" UINT __stdcall LocateFile(MSIHANDLE hInstall) { char* pDirPath = NULL; DWORD dw = 0; if( ERROR_MORE_DATA!=MsiGetProperty(hInstall,"MYFOLDER",NULL,&dw) ) return ERROR_INSTALL_FAILURE; dw += strlen("requiredfile.txt") + 1 /* term. NULL */; pDirPath = new char[dw]; pDirPath[0] = '\0'; if( ERROR_SUCCESS!=MsiGetProperty(hInstall,"MYFOLDER",pDirPath,&dw) ) { delete[] pDirPath; return ERROR_INSTALL_FAILURE; } _ASSERTE( 0!=strlen(pDirPath) ); if( PathFileExists(pDirPath) ) { MsiSetProperty(hInstall,"MYFILEEXISTS",pDirPath); // Dr. Evil assumption } delete[] pDirPath; return ERROR_SUCCESS; } I believe that something like this would work. On 3/16/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: If I look at the log after a completed installation, I can see the following property values. Property(S): MYFOLDER = C:\FTP\#This is the folder I selected in the dialog … Property(S): MYFILEEXISTS = C:\requiredfile.txt #this is where the file was found (MYFOLDER was initialized to 'c:\') So MYFOLDER did get set, but it seems to happen after the directory search took place. Would it be possible to have AppSearch happen sometime in the UI sequence, or would that break something else? It looks like by default It happens very early on. -- *From:* Levi Wilson [mailto:[EMAIL PROTECTED] *Sent:* Thursday, March 15, 2007 4:36 PM *To:* Rowland, Chris *Cc:* wix-users@lists.sourceforge.net *Subject:* Re: [WiX-users] verify file existance custom action Hmmm, I've never used a directory search like that. So you're saying that your MYFOLDER property isn't getting set when the directory search is performed? I think you probably *will* need to maybe use a custom action then since I don't think you can dynamically manipulate a directory search, or tell it when to perform it as I think file searches get executed during the AppSearch sequence? I could be wrong, but I don't think you can use the FileSearch like this. On 3/15/07, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: That actually looks like exactly what I want… much cleaner than my C++ hackjob. That gives me a followup question, however. I plugged your suggestion (with Depth="0") into my dialog I use to browse to the directory that contains the file. It appears that the property I'm trying to set to the browsed-to directory doesn't contain the browsed-to directory when the DirectorySearch is performed. NOT MYFILEEXISTS MYFILEEXISTS I initialized MYFOLDER with This works if requiredfile.txt is in c:\ (I can see MYFILEEXISTS=c:\requiredfile.txt in the log) It doesn't work if I browse to the directory that contains the file (and of course I remove the file from c:\ ) Thanks for the help so far, this feels like a much better way than what I was previously attempting. -- *From:* Levi Wilson [mailto:[EMAIL PROTECTED] *Sent:* Thursday, March 15, 2007 3:50 PM *To:* Rowland, Chris *Cc:* wix-users@lists.sourceforge.net *Subject:* Re: [WiX-users] verify file existance custom action Can you post your CA C++ code? Also, you don't need to have a DLL custom action to check for the existence of a file. You can do something like this in your WiX source: If the file has been found, then the MyFileExists property will be set to the full path of your file. Is this what you're looking for? On 3/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I read that "managed code" in a custom action is a no-no (please forgive me if I use the wrong terminology) so I am attempting to write my custom action without using managed code. Most examples I find seem to use it, however, so I'm doing the best I can. I wrote a simple VC++ app (.exe) that will determine if some files exist. I probably did it badly, but it worked in that context. I took the same code, and cut& paste into a VC++ file I had setup to create my dll. The code was previously a working snippet that would simply set a msi property to "true" and return ERROR_SUCCESS. I am now trying to make it do something useful. After the cut& paste I got some build errors and followed (somewhat) the steps listed here to resolve them. http://support.microsoft.com/?kbid=814472 The dll built successfully, but when I run the installer I get error 2896, "Executing action [2] failed." That doesn't tell me too much. I stepped backwards until I had one line that I could comment/uncomment to make the dll work(return &q
Re: [WiX-users] verify file existance custom action
Yeah, that's what I was trying to say. I believe this happens in the AppSearch sequence. You probably will need to use a CA for this to happen. I can try to help you with this as well, but it might look something like the following: extern "C" UINT __stdcall LocateFile(MSIHANDLE hInstall) { char* pDirPath = NULL; } On 3/16/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: If I look at the log after a completed installation, I can see the following property values. Property(S): MYFOLDER = C:\FTP\#This is the folder I selected in the dialog … Property(S): MYFILEEXISTS = C:\requiredfile.txt #this is where the file was found (MYFOLDER was initialized to 'c:\') So MYFOLDER did get set, but it seems to happen after the directory search took place. Would it be possible to have AppSearch happen sometime in the UI sequence, or would that break something else? It looks like by default It happens very early on. -- *From:* Levi Wilson [mailto:[EMAIL PROTECTED] *Sent:* Thursday, March 15, 2007 4:36 PM *To:* Rowland, Chris *Cc:* wix-users@lists.sourceforge.net *Subject:* Re: [WiX-users] verify file existance custom action Hmmm, I've never used a directory search like that. So you're saying that your MYFOLDER property isn't getting set when the directory search is performed? I think you probably *will* need to maybe use a custom action then since I don't think you can dynamically manipulate a directory search, or tell it when to perform it as I think file searches get executed during the AppSearch sequence? I could be wrong, but I don't think you can use the FileSearch like this. On 3/15/07, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: That actually looks like exactly what I want… much cleaner than my C++ hackjob. That gives me a followup question, however. I plugged your suggestion (with Depth="0") into my dialog I use to browse to the directory that contains the file. It appears that the property I'm trying to set to the browsed-to directory doesn't contain the browsed-to directory when the DirectorySearch is performed. NOT MYFILEEXISTS MYFILEEXISTS I initialized MYFOLDER with This works if requiredfile.txt is in c:\ (I can see MYFILEEXISTS=c:\requiredfile.txt in the log) It doesn't work if I browse to the directory that contains the file (and of course I remove the file from c:\ ) Thanks for the help so far, this feels like a much better way than what I was previously attempting. -- *From:* Levi Wilson [mailto:[EMAIL PROTECTED] *Sent:* Thursday, March 15, 2007 3:50 PM *To:* Rowland, Chris *Cc:* wix-users@lists.sourceforge.net *Subject:* Re: [WiX-users] verify file existance custom action Can you post your CA C++ code? Also, you don't need to have a DLL custom action to check for the existence of a file. You can do something like this in your WiX source: If the file has been found, then the MyFileExists property will be set to the full path of your file. Is this what you're looking for? On 3/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I read that "managed code" in a custom action is a no-no (please forgive me if I use the wrong terminology) so I am attempting to write my custom action without using managed code. Most examples I find seem to use it, however, so I'm doing the best I can. I wrote a simple VC++ app (.exe) that will determine if some files exist. I probably did it badly, but it worked in that context. I took the same code, and cut& paste into a VC++ file I had setup to create my dll. The code was previously a working snippet that would simply set a msi property to "true" and return ERROR_SUCCESS. I am now trying to make it do something useful. After the cut& paste I got some build errors and followed (somewhat) the steps listed here to resolve them. http://support.microsoft.com/?kbid=814472 The dll built successfully, but when I run the installer I get error 2896, "Executing action [2] failed." That doesn't tell me too much. I stepped backwards until I had one line that I could comment/uncomment to make the dll work(return "true")/not work(error 2896) The one line that causes it to fail (and concequently causes the dll to double in size) is: ifstream fin1(filename); Down the road I was doing 'if (fin1.good())' to see if the file exists (like I said, probably a bad way, but it was the first thing I did that seemed to work) Is attempting to do this fundamentally wrong? Also, I'm running the installer with /l* but I'm still not getting anything par
Re: [WiX-users] verify file existance custom action
If I look at the log after a completed installation, I can see the following property values. Property(S): MYFOLDER = C:\FTP\#This is the folder I selected in the dialog ... Property(S): MYFILEEXISTS = C:\requiredfile.txt #this is where the file was found (MYFOLDER was initialized to 'c:\') So MYFOLDER did get set, but it seems to happen after the directory search took place. Would it be possible to have AppSearch happen sometime in the UI sequence, or would that break something else? It looks like by default It happens very early on. From: Levi Wilson [mailto:[EMAIL PROTECTED] Sent: Thursday, March 15, 2007 4:36 PM To: Rowland, Chris Cc: wix-users@lists.sourceforge.net Subject: Re: [WiX-users] verify file existance custom action Hmmm, I've never used a directory search like that. So you're saying that your MYFOLDER property isn't getting set when the directory search is performed? I think you probably will need to maybe use a custom action then since I don't think you can dynamically manipulate a directory search, or tell it when to perform it as I think file searches get executed during the AppSearch sequence? I could be wrong, but I don't think you can use the FileSearch like this. On 3/15/07, [EMAIL PROTECTED] < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: That actually looks like exactly what I want... much cleaner than my C++ hackjob. That gives me a followup question, however. I plugged your suggestion (with Depth="0") into my dialog I use to browse to the directory that contains the file. It appears that the property I'm trying to set to the browsed-to directory doesn't contain the browsed-to directory when the DirectorySearch is performed. NOT MYFILEEXISTS MYFILEEXISTS I initialized MYFOLDER with This works if requiredfile.txt is in c:\ (I can see MYFILEEXISTS=c:\requiredfile.txt in the log) It doesn't work if I browse to the directory that contains the file (and of course I remove the file from c:\ ) Thanks for the help so far, this feels like a much better way than what I was previously attempting. From: Levi Wilson [mailto:[EMAIL PROTECTED] Sent: Thursday, March 15, 2007 3:50 PM To: Rowland, Chris Cc: wix-users@lists.sourceforge.net Subject: Re: [WiX-users] verify file existance custom action Can you post your CA C++ code? Also, you don't need to have a DLL custom action to check for the existence of a file. You can do something like this in your WiX source: If the file has been found, then the MyFileExists property will be set to the full path of your file. Is this what you're looking for? On 3/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I read that "managed code" in a custom action is a no-no (please forgive me if I use the wrong terminology) so I am attempting to write my custom action without using managed code. Most examples I find seem to use it, however, so I'm doing the best I can. I wrote a simple VC++ app (.exe) that will determine if some files exist. I probably did it badly, but it worked in that context. I took the same code, and cut& paste into a VC++ file I had setup to create my dll. The code was previously a working snippet that would simply set a msi property to "true" and return ERROR_SUCCESS. I am now trying to make it do something useful. After the cut& paste I got some build errors and followed (somewhat) the steps listed here to resolve them. http://support.microsoft.com/?kbid=814472 The dll built successfully, but when I run the installer I get error 2896, "Executing action [2] failed." That doesn't tell me too much. I stepped backwards until I had one line that I could comment/uncomment to make the dll work(return "true")/not work(error 2896) The one line that causes it to fail (and concequently causes the dll to double in size) is: ifstream fin1(filename); Down the road I was doing 'if (fin1.good())' to see if the file exists (like I said, probably a bad way, but it was the first thing I did that seemed to work) Is attempting to do this fundamentally wrong? Also, I'm running the installer with /l* but I'm still not getting anything particularly helpful. Are there better techniques for debugging? - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cas
Re: [WiX-users] verify file existance custom action
Hmmm, I've never used a directory search like that. So you're saying that your MYFOLDER property isn't getting set when the directory search is performed? I think you probably will need to maybe use a custom action then since I don't think you can dynamically manipulate a directory search, or tell it when to perform it as I think file searches get executed during the AppSearch sequence? I could be wrong, but I don't think you can use the FileSearch like this. On 3/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: That actually looks like exactly what I want… much cleaner than my C++ hackjob. That gives me a followup question, however. I plugged your suggestion (with Depth="0") into my dialog I use to browse to the directory that contains the file. It appears that the property I'm trying to set to the browsed-to directory doesn't contain the browsed-to directory when the DirectorySearch is performed. NOT MYFILEEXISTS MYFILEEXISTS I initialized MYFOLDER with This works if requiredfile.txt is in c:\ (I can see MYFILEEXISTS=c:\requiredfile.txt in the log) It doesn't work if I browse to the directory that contains the file (and of course I remove the file from c:\ ) Thanks for the help so far, this feels like a much better way than what I was previously attempting. -- *From:* Levi Wilson [mailto:[EMAIL PROTECTED] *Sent:* Thursday, March 15, 2007 3:50 PM *To:* Rowland, Chris *Cc:* wix-users@lists.sourceforge.net *Subject:* Re: [WiX-users] verify file existance custom action Can you post your CA C++ code? Also, you don't need to have a DLL custom action to check for the existence of a file. You can do something like this in your WiX source: If the file has been found, then the MyFileExists property will be set to the full path of your file. Is this what you're looking for? On 3/15/07, * [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I read that "managed code" in a custom action is a no-no (please forgive me if I use the wrong terminology) so I am attempting to write my custom action without using managed code. Most examples I find seem to use it, however, so I'm doing the best I can. I wrote a simple VC++ app (.exe) that will determine if some files exist. I probably did it badly, but it worked in that context. I took the same code, and cut& paste into a VC++ file I had setup to create my dll. The code was previously a working snippet that would simply set a msi property to "true" and return ERROR_SUCCESS. I am now trying to make it do something useful. After the cut& paste I got some build errors and followed (somewhat) the steps listed here to resolve them. http://support.microsoft.com/?kbid=814472 The dll built successfully, but when I run the installer I get error 2896, "Executing action [2] failed." That doesn't tell me too much. I stepped backwards until I had one line that I could comment/uncomment to make the dll work(return "true")/not work(error 2896) The one line that causes it to fail (and concequently causes the dll to double in size) is: ifstream fin1(filename); Down the road I was doing 'if (fin1.good())' to see if the file exists (like I said, probably a bad way, but it was the first thing I did that seemed to work) Is attempting to do this fundamentally wrong? Also, I'm running the installer with /l* but I'm still not getting anything particularly helpful. Are there better techniques for debugging? - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users
Re: [WiX-users] verify file existance custom action
That actually looks like exactly what I want... much cleaner than my C++ hackjob. That gives me a followup question, however. I plugged your suggestion (with Depth="0") into my dialog I use to browse to the directory that contains the file. It appears that the property I'm trying to set to the browsed-to directory doesn't contain the browsed-to directory when the DirectorySearch is performed. NOT MYFILEEXISTS MYFILEEXISTS I initialized MYFOLDER with This works if requiredfile.txt is in c:\ (I can see MYFILEEXISTS=c:\requiredfile.txt in the log) It doesn't work if I browse to the directory that contains the file (and of course I remove the file from c:\ ) Thanks for the help so far, this feels like a much better way than what I was previously attempting. From: Levi Wilson [mailto:[EMAIL PROTECTED] Sent: Thursday, March 15, 2007 3:50 PM To: Rowland, Chris Cc: wix-users@lists.sourceforge.net Subject: Re: [WiX-users] verify file existance custom action Can you post your CA C++ code? Also, you don't need to have a DLL custom action to check for the existence of a file. You can do something like this in your WiX source: If the file has been found, then the MyFileExists property will be set to the full path of your file. Is this what you're looking for? On 3/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I read that "managed code" in a custom action is a no-no (please forgive me if I use the wrong terminology) so I am attempting to write my custom action without using managed code. Most examples I find seem to use it, however, so I'm doing the best I can. I wrote a simple VC++ app (.exe) that will determine if some files exist. I probably did it badly, but it worked in that context. I took the same code, and cut& paste into a VC++ file I had setup to create my dll. The code was previously a working snippet that would simply set a msi property to "true" and return ERROR_SUCCESS. I am now trying to make it do something useful. After the cut& paste I got some build errors and followed (somewhat) the steps listed here to resolve them. http://support.microsoft.com/?kbid=814472 The dll built successfully, but when I run the installer I get error 2896, "Executing action [2] failed." That doesn't tell me too much. I stepped backwards until I had one line that I could comment/uncomment to make the dll work(return "true")/not work(error 2896) The one line that causes it to fail (and concequently causes the dll to double in size) is: ifstream fin1(filename); Down the road I was doing 'if (fin1.good())' to see if the file exists (like I said, probably a bad way, but it was the first thing I did that seemed to work) Is attempting to do this fundamentally wrong? Also, I'm running the installer with /l* but I'm still not getting anything particularly helpful. Are there better techniques for debugging? - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE V ___ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users
Re: [WiX-users] verify file existance custom action
Can you post your CA C++ code? Also, you don't need to have a DLL custom action to check for the existence of a file. You can do something like this in your WiX source: If the file has been found, then the MyFileExists property will be set to the full path of your file. Is this what you're looking for? On 3/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I read that "managed code" in a custom action is a no-no (please forgive me if I use the wrong terminology) so I am attempting to write my custom action without using managed code. Most examples I find seem to use it, however, so I'm doing the best I can. I wrote a simple VC++ app (.exe) that will determine if some files exist. I probably did it badly, but it worked in that context. I took the same code, and cut& paste into a VC++ file I had setup to create my dll. The code was previously a working snippet that would simply set a msi property to "true" and return ERROR_SUCCESS. I am now trying to make it do something useful. After the cut& paste I got some build errors and followed (somewhat) the steps listed here to resolve them. http://support.microsoft.com/?kbid=814472 The dll built successfully, but when I run the installer I get error 2896, "Executing action [2] failed." That doesn't tell me too much. I stepped backwards until I had one line that I could comment/uncomment to make the dll work(return "true")/not work(error 2896) The one line that causes it to fail (and concequently causes the dll to double in size) is: ifstream fin1(filename); Down the road I was doing 'if (fin1.good())' to see if the file exists (like I said, probably a bad way, but it was the first thing I did that seemed to work) Is attempting to do this fundamentally wrong? Also, I'm running the installer with /l* but I'm still not getting anything particularly helpful. Are there better techniques for debugging? - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users