PDA

View Full Version : Build VS.Net 2005 Website


jnapier
05-12-2006, 01:00 PM
Hi, I am wondering how I can go about compiling a VS.Net 2005 Website when the solution is built. I have the Build Website as Part of solution option checked.

I have tried building the solution with devenv through the Make Vs.Net action but that doesn't work.

Do I have to do something extra to get the website to build or am I missing a setting?

I understand that the ASP.Net 2.0 Website model is to dynamically compile the pages, but as part of my build process I want to make sure that all the pages of the site compile correctly.

Thanks

kinook
05-12-2006, 05:52 PM
In my testing, this does precompile the web site. I created a new C# web site project, then created a step in VBP to build the solution for it, and building the step in VBP resulted in a PrecompiledWeb folder below the .sln file with the DLL in the site\bin folder. The default behavior is to use MSBuild, but choosing devenv in the compiler override field generated the same output.

jnapier
05-25-2006, 08:09 PM
This solution was upgraded from a 1.1 solution so I am wondering if there is something that is not appearing in the solution file correctly.

Also, I am using an IIS site and not a file system site. Could that by why you are getting a different result. When I build the solution with vs.net, the website does precompile. If I build the solution from Visual Build it does not, so there has to be some difference between the 2.

Any ideas?

jnapier
05-25-2006, 09:00 PM
Are you sure that this worked for you from Visual Build? I just created a brand new solution and a file system website and got the exact same results as in my original solution.

I can send you the sample solution and build script if you would like.

When I use the Make VS.Net action from Visual Build, the WebSite is definitely not precompiled. I can verify this by the fact that the output tab in visual build makes no mention of precompiling the site, and there is no PreCompiledWeb folder on my harddrive.

We must be doing something different here.

kinook
05-26-2006, 08:02 AM
I tried it both ways (creating new C# HTTP and File system web sites). In both cases, when building the solution via the Make VS.NET action, I get output like:

5/26/2006 6:40:53 AM: Building project step 'Make VS 2005'...
Pre-processing...

Building configuration 'Debug|.NET'...
Microsoft (R) Build Engine Version 2.0.50727.42
[Microsoft .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation 2005. All rights reserved.

__________________________________________________
Project "C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\filetest\filetest.sln" (default targets):

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspn et_compiler.exe -v /filetest -p ..\..\WebSites\filetest\ -u -f -d PrecompiledWeb\filetest\


The last line is the output of the precompilation. The precompilation output path is governed by 'right-click project -> Property Pages -> MSBuild Options -> Output Folder.'

If I delete the PrecompiledWeb folders and build again from VBP, they are regenerated.

I tested on Windows XP SP2 w/ VS 2005 Pro RTM (8.0.50727.42). Attached are my solutions, projects, bld and log file.

jnapier
05-26-2006, 01:14 PM
I can't run your build script. I have the latest 6.1 version.

I have attached an image that shows the problem.

kinook
05-26-2006, 01:27 PM
The ZIP file was fixed; download and try again.

jnapier
05-26-2006, 03:21 PM
I've tracked down the problem. I was building the Configuration Release| Any CPU and it appears that by default, the website is not set to build in this mode. Its hidden in the configuration manager because you have to change the buiod platform dropdown. Regardless, setting the website to build in this configuration fixed the problem and now my build script builds the websote as your sample project does. Thank you.

In fixing this, I found a little problem with the increment version capability. We placed an AssemblyInfo.cs file into the App_Code directory so that we can have access to a build number to display on our website for maintenance purposes. The increment version of the Make VS.NEt step does not update an Assembly Info file in the Web project. It updates the AssemblyInfo for the other projects, but not the web project.

Thanks for the help.

kinook
05-26-2006, 04:54 PM
Because VS 2005 web sites have no project file (and hence no declaration of the assemblyinfo file) versioning of them is not currently supported directly:
http://www.kinook.com/Forum/showthread.php?threadid=1355

Another option would be to convert to VS 2005 Web Application Projects, which are more like pre-2005 web projects and actually have a project file:
http://weblogs.asp.net/scottgu/archive/2006/05/08/VS-2005-Web-Application-Project-V1.0-Released.aspx