Creating Packaged ASP.NET Setup Programs

Topics: Developer Forum
Jan 13, 2009 at 5:24 AM
Hi how can i create an .msi or installer file of N2 templates. i've downloaded the whole source file and do some editing on the N2Template  project.. i jsut need to create an installer/ .msi file for the project. Thanks in advance!
Jan 13, 2009 at 11:17 AM
A possible strategy for packaging is to use a ASP.Net pre-compilation feature.

Advantages it has are these:
  • ASP.Net pre-compilation ensures that not only normal code files are correct, but guarantees that .aspx/.ascx stuff can be compiled too (this is something usually revealed only at run-time)
  • Use of only standard .Net tools (no need for non-free VS.Net editions)
  • x-copy. i.e. "easiest", deployment
  • smallest footprint
  • no need to expose neither source-code nor .aspx markup
The process itself, tailored specifically to N2, might look like this:
  1. Export your database via ~/Edit/Export/ and put the resulting .gzip file into ~/App_Data -- this will make your deployment package database-neutral and will allow to roll it up quickly into any database N2 (NHibernate, actually) supports during N2 installation procedure
  2. Ensure that in your web.config ContentRoleProvider and ContentMembershipProvide are either temporary dsiabled or not used -- this will help to avoid numerous possible obstacles during installation
  3. Execute the following command over your site (assuming that wwwroot is a folder with your web application): c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -v MyAppName -p wwwroot MyPreCompiledAppPath -- if everything go smoothly in MyPreCompiledAppPath you'll get a pre-compiled nearly site ready for deployment
  4. Clean up unneccessary files and folders beneth MyPreCompiledAppPath. There might many, i use to delete the following:
    • *.csproj
    • .\obj
    • bin\*.pdb
    • *.publish
  5. Archive MyPreCompiledAppPath
Now deployment might look like this:
  1. Extract files, configure virtual folders/sites in IIS, etc. (a usual but routine IIS stuff)
  2. Create/configure database (also, a generic procedure, but deserves a dedicated discussion)
  3. Run web application and navigate to ~/Edit/Install
  4. On 4th step select a .gzip from ~/App_Data to be imported
  5. Optionally: configure Content*ProviderS, remove admin/changeme
Good luck!