views:

232

answers:

2

Hello everyone,

I am using VSTS 2008 and I am using Create new ASP.Net web site and using default settings/automatically generated files.

My questions are,

  1. How to use command line script (msbuild) to build the ASP.Net web site automatically?
  2. I want to build the web site into a DLL which could be easily copied to target IIS server later.

Any samples or quick answer how to do these tasks in msbuild?

thanks in advance, George

EDIT1: There is no sln and csproj file in the web site folder. Here is the link.

http://tinypic.com/view.php?pic=dra5jp&s=5

Here is how I create in VSTS 2008.

http://i40.tinypic.com/208zfxv.jpg

+1  A: 

I use VS.NET 2005 and using this command to build my asp.net web application in release mode :

cd "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\"
MSBuild "C:\Projects\MyProject.csproj" /t:Rebuild /p:Configuration=Release /verbosity:quiet /p:WarningLevel=0
Canavar
@Canavar, I can not find any project file (.csproj) in the web site folder. Are you creating ASP.Net web application or creating New ASP.Net Web Site? My question is dealing with creating new ASP.Net Web Site.
George2
I'm using Web Application, but , did you look at the "C:\Documents and Settings\USER_NAME\My Documents\Visual Studio 2005\Projects" directory for your *.csproj file ?
Canavar
I suppose for web sites there is a *.sln file in "C:\Documents and Settings\USER_NAME\My Documents\Visual Studio 2005\Projects\project_name\" you can use it to build your web site.
Canavar
@Canavar, I have tried again, but there is no sln or csproj files in web site folder. Please check the EDIT 1 section of my original post for my screen snapshots. Any ideas what is wrong?
George2
@George2 : I can not open your images in office :( but, visual studio stores your solution file into your Documents folder, not in your project folder. I'm not sure you looked at that folder.
Canavar
@Canavar, I have checked you are correct that the solution file is there, but project file is not there.
George2
@George2, you can use sln file to build your website. Is there a problem with it ?
Canavar
@Canavar, I have tried to use msbuild XXX.sln, but met with the following error. Any ideas what is wrong?ASPNETCOMPILER : error ASPRUNTIME: The precompilation target directory (D:\Test\App\Website\PrecompiledWeb\Website\) cannot be in the same tree as the source application directory (D:\Test\App\Website\PrecompiledWeb\Website\).
George2
+1  A: 

"Web Applications" have .csproj files, "Web Sites" do not. http://damieng.com/blog/2008/02/07/web-site-vs-web-application

You want to compile it with aspnet_compiler.exe in the bin directory C:\windows\framework\version

http://msdn.microsoft.com/en-us/library/ms178466.aspx

Easier way is to use deployment projects or the "Publish Web Site" command in Visual Studio. (Right Click on website)

http://weblogs.asp.net/scottgu/archive/2008/01/28/vs-2008-web-deployment-project-support-released.aspx

Chad Grant
@Deviant, my purpose is using command line to automatically build/deploy all web site needed files (DLL for code behind file, aspx and images). Do you have any advice for solution in my situation?
George2
I have another idea, could my task be completed easier if I create web application other than creating web site?
George2
Yes it could, Then you could use Canavar's way , you'd have a csproj
Chad Grant
Canavar's way? You mean?
George2