locked
Sneaky Way to get an EULA displayed for your clickonce application in VS2005 RRS feed

  • General discussion

  • Here's a round about way to get your clickonce applications to install with an End user license agreement.

    Basically you build a redistributable component that can be seen in your prerequsites dialog box under the publish window. This allows a nice way to have all your apps reuse the same agreement, if you want.

    It's very easy,  you need only to create three files ("eula.txt", "product.xml", and "package.xml") and two folders in this case ("EULApackage", and "en").  I documented everything below on how I set mine up. it works great.  the only thing you'll have to change is the Name of the component and of course you'll need your own end user licence agreement saved as eula.txt.

    The component needs to be put in the following path:

    C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages

    in this folder you should see some sub folders for other redistributable components.  First make a new sub directory for your component.  I called mine EULApackage.

    in this new folder you need the following.

    -A file called product.xml and a sub folder called "en" (for english)

    you can do various things with the product.xml file, but here's the way mine looks

    <?xml version="1.0" encoding="utf-8" ?>

    <Product
      xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
      ProductCode="EULA.Bootstrap.Component"
    >
      <!-- Defines list of files to be copied on build -->
      <PackageFiles>
        <PackageFile Name="en/eula.txt"/>
      </PackageFiles>


      <Commands>
        <Command PackageFile="en/eula.txt"
          Arguments='' >

           <ExitCodes>
             <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
           </ExitCodes>

        </Command>
      </Commands>
    </Product>

     

    in this case the file eula.txt was the text file that was my license agreement.  Note that it's not an rtf file.  Rtf won't display propertly using this method.

    Now inside my "en" subfolder i put the eula.txt file and another xml file called package.xml, again this xml file can be used to do all kinds of stuff

    heres the contents of my version

     <?xml version="1.0" encoding="utf-8" ?>

    <Package
      xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
      Name="DisplayName"
      Culture="Culture"
      LicenseAgreement="eula.txt">

        <PackageFiles>
            <PackageFile Name="eula.txt"/>
        </PackageFiles>

      <!-- Defines a localizable string table for error messages and url's  -->
      <Strings>
        <String Name="DisplayName">Texas Instruments End User License Agreement</String>
        <String Name="Culture">en</String>
       
        <String Name="CancelFailure">User Failed to Accept Texas Instruments End User License Agreement.</String>
        <String Name="GeneralFailure">A fatal error occurred during the installation of ELUA Component Execution</String>
        <String Name="AdminRequired">You do not have the permissions required to install this application.  Please contact your

    administrator.</String>
      </Strings>

    </Package>

     Note: whatever you put in the DisplayName field is what your user will see when he's confronted with the eula text

    If you have all this put together correctly and in the right folders, the next time you start up VS2005 and go to your publish tab -> prerequisites you should see the DisplayName field.  Just check this as a prerequisite for you app.

    when the user clicks install on the publish.htm file it'll present the user with the conents of your eula.txt file inside of a standard license acceptance dialog box. if the choose accept your stuff installs, if they decline then it exits rather nicely and nothing is installed on their systems.

    If you mess up the formatting for either of the two files or if you leave out the "en" sub folder then the component won't show up in the prerequisites dialog (when publishing)

    Additional notes: although this works great it is a round about method and their are ways around the eula, such as if your publish.htm file allows them to run the application directly (I guess without the bootstrapper starting)but if they click the install button it will run. 

    This also has the benifits of not running every time you publish an update to your clickonce application. They have to run the boot strapper to get the eula to show up (by clicking the install button on publish.htm)

    I figured out this method by looking at some of the other redistributable components that were already in the path  C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages.  You can look in those other components product.xml and package.xml files to see what cool things they've done with them.

     Good luck

     

    Thursday, July 20, 2006 5:29 PM

All replies

  • Thank you so much for posting this. I needed this and could not figure out how to do it. Now it works. Thanks again!

     

    Friday, August 24, 2007 7:54 PM
  • Can some one assist me in attaching the EULA for Click Once setup for application developed in VS 2008
    Friday, May 16, 2008 7:09 AM
  • for vs2008 it's the same thing but the prerequisites are located in C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Eula instead.
    Saturday, April 18, 2009 7:54 PM
  • Hi all.
    During the installation with other prerequisite "from vendor website" I have to modify the product ErrorCodes fragment like that:

    <?xml version="1.0" encoding="utf-8" ?>

    <Product
      xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
      ProductCode="EULA.Bootstrap.Component">
      <!-- Defines list of files to be copied on build -->
      <PackageFiles>
        <PackageFile Name="en/eula.txt"/>
      </PackageFiles>

      <Commands>
        <Command PackageFile="en/eula.txt"
          Arguments='' >
           <ExitCodes>
             <ExitCode Value="0" Result="Success"/>
           </ExitCodes>
        </Command>
      </Commands>
    </Product>

    Wednesday, June 10, 2009 4:21 PM
  • I am working with VS2010.  The above code comes close to what I want, but I am getting some pushback from users because:

    1)  During a clean installation you get the LiscenseAgreement dialog box, which itself displays the EULA.  It has three buttons, one to view the EULA (not quite sure why, as the EULA is sitting right there.  It shows the EULA by opening it in Word.), an Accept button and a Don't Accept button.

    2) Selecting the Accept button will proceed to a "Program Setup" dialog box that says "Installing the EULA"

    3) Then, automatically, it displays the EULA and waits for the user to close the notepad window.

    I am getting pushback on this last notepad window, as it is unnecessary AND it stalls the installation.

    How can I stop that last step from happening?  The user has had two chances to see the EULA, one being a small window actually displaying the EULA; the second being the chance to view the EULA in Word.  Why is the bootstrapper forcing yet another viewing of the EULA?

    John

    For completeness, I include the code I am using:

    <?xml version="1.0" encoding="utf-8" ?> 
     
    <Package 
     xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" 
     Name="DisplayName" 
     Culture="Culture" 
     LicenseAgreement="eula.txt"> 
     
      <PackageFiles> 
        <PackageFile Name="eula.txt"/> 
      </PackageFiles> 
     
     <!-- Defines a localizable string table for error messages and url's --> 
     <Strings> 
      <String Name="DisplayName">The Toro Company End User License Agreement</String> 
      <String Name="Culture">en</String> 
     
      <String Name="CancelFailure">User Failed to Accept The Toro Company End User License Agreement.</String> 
      <String Name="GeneralFailure">A fatal error occurred during the installation of EULA Component Execution</String> 
      <String Name="AdminRequired">You do not have the permissions required to install this application. Please contact your administrator.</String> 
     </Strings>   
    </Package>
    
    <?xml version="1.0" encoding="utf-8" ?> 
     
    <Product 
     xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" 
     ProductCode="EULA.Bootstrap.Component" 
    > 
     <!-- Defines list of files to be copied on build -->
     <PackageFiles CopyAllPackageFiles="true"> 
      <PackageFile Name="en/eula.txt"/> 
     </PackageFiles> 
     
     
     <Commands> 
      <Command PackageFile="en/eula.txt" 
       Arguments='' > 
     
        <ExitCodes>
         <ExitCode Value="0" Result="Success"/>
         <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" /> 
        </ExitCodes> 
     
      </Command> 
     </Commands> 
    </Product>
    
    Tuesday, July 13, 2010 2:34 PM
  • Kicking the subject into the ground...

    The above code uses the line:

        <PackageFile Name="en/eula.txt"/>

    I will be delivering product in the EU.  I support 10-12 languages.  How do I desplay the Spanish (es) version of the EULA?

    Do I have to have a PackageFile for each language and a Command for each language with some kinda skipif condition checking the environment's language?

    Regardless of the solution, what is the solution?  Would there be an example?

    John

    Tuesday, July 13, 2010 2:54 PM
  • Kicking the subject into the ground...

    The above code uses the line:

        <PackageFile Name="en/eula.txt"/>

    I will be delivering product in the EU.  I support 10-12 languages.  How do I desplay the Spanish (es) version of the EULA?

    Do I have to have a PackageFile for each language and a Command for each language with some kinda skipif condition checking the environment's language?

    Regardless of the solution, what is the solution?  Would there be an example?

    John

    I guess this is right(someone correct me if I'm wrong) but you would just create another folder named eu, and make a spanish version of the eula, and you would also create another folder called es and I guess you would have to have another PackageFile(Which is a another Package.xml file in each folder.) and yes another package file for each language, which if you wanted spainsh, you would make the package file(eula) in spainsh, and a Command for each language with some kinda skipif condition, checking the environment's language.

    So the package.xml would look like this(for spainsh)

    <?xml version="1.0" encoding="utf-8" ?>

    <Package
      xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
      Name="DisplayName"
      Culture="Culture"
      LicenseAgreement="eula.txt">

        <PackageFiles>
            <PackageFile Name="eula.txt"/>
        </PackageFiles>

      <!-- Defines a localizable string table for error messages and url's  -->
      <Strings>
        <String Name="DisplayName">Texas Instruments End User License Agreement</String>
        <String Name="Culture">en(or whatever language you need right here)</String>
       
        <String Name="CancelFailure">User Failed to Accept Texas Instruments End User License Agreement.</String>
        <String Name="GeneralFailure">A fatal error occurred during the installation of ELUA Component Execution</String>
        <String Name="AdminRequired">You do not have the permissions required to install this application.  Please contact your

    administrator.</String>
      </Strings>

    </Package>

     And the product.xml would look like this:

    <?xml version="1.0" encoding="utf-8" ?>

    <Product
      xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
      ProductCode="EULA.Bootstrap.Component"
    >
      <!-- Defines list of files to be copied on build -->
      <PackageFiles>
        <PackageFile Name="en(or whatever language you need)/eula.txt"/>
      </PackageFiles>


      <Commands>
        <Command PackageFile="en(or whatever language you need)/eula.txt"
          Arguments='' >

           <ExitCodes>
             <ExitCode Value="0" Result="Success"/>
           </ExitCodes>

        </Command>
      </Commands>
    </Product> 

    Saturday, October 9, 2010 2:51 AM
  • I wonder if you have the solution for the popup of EULA twice?
    Tuesday, February 1, 2011 4:39 PM
  • I wonder if you have the solution for the popup of EULA twice?

    Not if you set it to your specific one language:


    <PackageFile Name="yourlanguage/eula.txt"/>

    and this to your specific one language

    <String Name="Culture">yourlanguage</String>

    Tuesday, February 1, 2011 6:31 PM
  • Here is the trick to getting rid of the notepad second pop-up (which is caused by the above request to run eula.txt with eula.txt as its license):

    Install a do-nothing eula.bat with eula.txt as the license.

    eula.bat and eula.txt go in the /en folder with package.xml.

    eula.bat has one line in it:  echo "EULA successfully installed"

    Here is my Product XML file (note that it runs eula.bat)

    <Product
      xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
      ProductCode="EULA.Bootstrap.Component"
    >
      <!-- Defines list of files to be copied on build -->
      <PackageFiles>
        <PackageFile Name="en/eula.bat"/>
        <PackageFile Name="en/eula.txt"/>
      </PackageFiles>

      <Commands>
        <Command PackageFile="en/eula.bat"
          Arguments='' >
           <ExitCodes>
             <ExitCode Value="0" Result="Success"/>
             <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
           </ExitCodes>
        </Command>
      </Commands>
    </Product>

    Here is the package.xml file (it copies both the eula.txt and eula.bat files in the <package> section, only runs the eula.bat (which does practically nothing), and displays the eula.txt file as the license.

    <?xml version="1.0" encoding="utf-8" ?>

    <Package
      xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
      Name="DisplayName"
      Culture="Culture"
      LicenseAgreement="eula.txt">

        <PackageFiles>
            <PackageFile Name="eula.txt"/>
            <PackageFile Name="eula.bat"/>
        </PackageFiles>

      <!-- Defines a localizable string table for error messages and url's  -->
      <Strings>
        <String Name="DisplayName">My Company End User License Agreement</String>
        <String Name="Culture">en</String>

        <String Name="CancelFailure">User Failed to Accept My Company End User License Agreement.</String>
        <String Name="GeneralFailure">A fatal error occurred during the installation of EULA Component Execution</String>
        <String Name="AdminRequired">You do not have the permissions required to install this application.  Please contact your administrator.</String>
      </Strings>   
    </Package>


    Monday, June 6, 2011 5:36 PM
  • Hello JWOsen,

    i had also used this step. I don't want to open notepad file. please help me for that.

    is thare any extra coding for that? please suggest me that.

     

    thanks and regards,

    sachin.

    Friday, September 16, 2011 11:11 AM