Reader small image

You're reading from  WiX Cookbook

Product typeBook
Published inJan 2015
Reading LevelBeginner
Publisher
ISBN-139781784393212
Edition1st Edition
Languages
Right arrow
Author (1)
Nicholas Matthew Ramirez
Nicholas Matthew Ramirez
author image
Nicholas Matthew Ramirez

Nick Ramirez is a software developer living in Columbus, Ohio. As a believer that deployment shouldn't be terrifying, he has become a big fan of technologies such as WiX. His other related interests include build automation, software architecture, and playing Minecraft. Nick lives with his wife and two cats.
Read more about Nicholas Matthew Ramirez

Right arrow

Marking a file as read only


The primary reason for making a file read only is to prevent it from being accidentally modified. This could apply to end-user license agreements, readme files, and other documents that the user might open with a text editor such as Word.

In this recipe, we'll install a text file and then set its Read-only flag.

Getting ready

To prepare for this recipe, create a new setup project and name it ReadOnlyInstaller.

How to do it…

Set the ReadOnly attribute on a File element to prevent it from being accidentally modified with the following steps:

  1. Add a File element within Component to install a file called Sample.txt:

    <ComponentGroup Id="ProductComponents" 
                    Directory="INSTALLFOLDER">
      <Component Id="cmpSampleTXT" 
                 Guid="{44BB2441-F98C-41F9-A1FE-EB732B626CF4}">
        <File Source="Sample.txt" />
      </Component>
    </ComponentGroup>
  2. Add the ReadOnly attribute to the File element to mark that file as read only:

    <File Source...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
WiX Cookbook
Published in: Jan 2015Publisher: ISBN-13: 9781784393212

Author (1)

author image
Nicholas Matthew Ramirez

Nick Ramirez is a software developer living in Columbus, Ohio. As a believer that deployment shouldn't be terrifying, he has become a big fan of technologies such as WiX. His other related interests include build automation, software architecture, and playing Minecraft. Nick lives with his wife and two cats.
Read more about Nicholas Matthew Ramirez