views:

11

answers:

1

I have added a config file (myapp.exe.config) that is deployed to the device after installation. But the problem is that this file gets read-only attribute. I have tried adding some stuff in the setup project in "codeINSTALL_EXIT" function. On emulator it works ... it removes the read only attribute, while when installing on the phone the attribute stays.

SetFileAttributes(szPathConfig, FILE_ATTRIBUTE_NORMAL)

Any ideas?

A: 

It's not completely clear from your question how the file is getting deployed (though I think from a CAb only). Things to check/know:

  • If you install via CAB, but then deploy from Studio (i.e. Debug) the file will get overwritten and the file studio pushes may well be read-only, especially if your SCC mechanism locks local files that aren't checked out (like VSS does).

  • When you build a CAB file, the file attributes get inherited from the source, meaning that if the file is read-only on the PC when you create the CAB, it will be read-only coming out of the CAB. One woudl think that the EXIT of the installer would be late enough to alter the attributes, but I've never tested it. Following your current path, you might check that the attributes before setting and also check to see if the Set call is actually succeeding. Personally I'd just make sure all files were read/write enabled before building the CAB to avoid the whole problem in the first place.

ctacke
the file sits in my /app/bin/release (where my .exe is) and doesnt have read only flag set. But when i create the .CAB file and install it on the device it gets read only flag. When i install the same cab on emulator the read only flag is not there (it gets removed) ! The code in my setup project (codeINSTALL_EXIT) gets executed and i included a message to shoot up (if(SetFileAttributes(szPathConfig,FILE_ATTRIBUTE_NORMAL) != 0) and i get a failure message, that changing of the file attr failed. This .config file is vital that the app works, and i dont know where it gets read only attr !! :S
no9

related questions