Showing posts with label msi project. Show all posts
Showing posts with label msi project. Show all posts

Wednesday, August 18, 2010

File Acess Rights during msi setup

you got a folder that needs to setup access rights during installation???

Win32Security dll can be used for this statue
here is the code block


DirectoryInfo imagesFolderInfo = new DirectoryInfo("the path of folder");
if (imagesFolderInfo.Exists)
{
// Give "NETWORK USER" user full access
SecurityDescriptor secDesc =
SecurityDescriptor.GetFileSecurity(
imagesFolderInfo.FullName,
SECURITY_INFORMATION.DACL_SECURITY_INFORMATION);

Dacl dacl = secDesc.Dacl;

dacl.AddAce(new AceAccessAllowed(new Sid("NETWORK SERVICE"),
AccessType.GENERIC_ALL | AccessType.STANDARD_RIGHTS_ALL,
/* AceFlags.OBJECT_INHERIT_ACE | */AceFlags.CONTAINER_INHERIT_ACE/*|AceFlags.VALID_INHERIT_FLAGS| AceFlags.SUCCESSFUL_ACCESS_ACE_FLAG*/));

secDesc.SetDacl(dacl);

secDesc.SetFileSecurity(
imagesFolderInfo.FullName,
SECURITY_INFORMATION.DACL_SECURITY_INFORMATION);

}

you can download Microsoft.Win32Security dll from that linkhttp://archive.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=WindowsFolderWebPart&DownloadId=665


**To Find out file path use Installer class' Context property

string logFileDirectory = string.Format("{0}Log", Context.Parameters["AssemblyPath"].Substring(0, Context.Parameters["AssemblyPath"].IndexOf("bin")));
this will return Log folder path

debugging custom action during msi setup

for debugging custom action during msi setup
just put

System.Diagnostics.Debugger.Launch();
on customaction code

Thursday, July 29, 2010

Windows Setup auto unistall /install trick

Merhaba arkadaşlar
Setup projeleriyle deploy edilen ürünlerde önceki kurulumu otomatik kaldırılmasına yönelik bir detay bilgiyi paylaşmak istedim..(belki birilerinin ihtiyacı olabilir)

VS ile gelen setup template ile hazırlanan projelerde oluşturulan msi vasıtası ile yapılan deploymentlarda
Client makinede ürünün herhangi bir sürümü hali hazırda kurulu bulunduğu durumlarda..
Kurulumun öncelikle otomatik olarak makinadaki mevcut kurulumu kaldırarak yeni versiyonu kurmasını istendiği hallerde

Kurulum projelerinizde aşağıdaki ayarlamaları yapmanız yeterli olacaktır.

1-)setup projesi >properities >RemovePreviousVersions =True

2-) setup projesi >properities >Version değeri güncellenir bu durumda vs ;product code u update etmek istiyormusunuz dialogu sorar ; evet diyerek onaylıyoruz



(Bu özelliğin geçerli olması için UpgradeCode özelliğinin setuplarda sabit tutulması gerekiyor..)