Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 2nd, 2008, 03:26 PM
Authorized User
Join Date: Mar 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default Publish ASP.Net Code with cmd Line using Process

Hello Friends,

All of us know how to publish a website in VS2005 (It is fairly simple).
I am publishing a ASP.NET application using VS2005 Command prompt and i succeed in it also.

Here is what i wrote on VS2005 Command prompt
aspnet_compiler -v /ABC -p E:\ABC -f -fixednames "D:\Publish" -c

The above code will publish the website ABC which is a virtual directory
in IIS with physical location E:\ABC. The target directory is
D:\Publish where we get the Resultant published code.

The same i willing to do using a Button_Click event
Here is the code.
Button_Click event
    System.Diagnostics.Process p1 = new Process();
    p1.StartInfo.ErrorDialog = true;
    p1.StartInfo.UseShellExecute = false;
    p1.StartInfo.RedirectStandardOutput = true;
    p1.StartInfo.RedirectStandardError = true;

    p1.StartInfo.FileName = @"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\as pnet_compiler.exe";

    p1.StartInfo.Arguments = "aspnet_compiler
    -v /ABC -p E:\ABC -f -fixednames \""D:\Publish"\" -c";

    string s = p1.StandardOutput.ReadToEnd();


I donot think there is any thing wrong in concatenating the argument string.

Still I get an Error Message and Website is not published

ERROR 1001 : Unexpected parameter :'D:\Publish'.

When u debug this code and copy the value of the expression p1.StartInfo.Arguments and paste in VS2005 Command prompt the code compiles without any error and Website gets published on the Target directory.

Then what is Missing in the Code.
All opinions will we accepted. Thanks in advance.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Publish The Asp.net project to web badboy1 ASP.NET 3.5 Basics 2 June 25th, 2008 05:04 PM
Callling cmd from ASP.NET web service Earl Hickey ASP.NET 2.0 Basics 2 December 5th, 2007 04:46 PM
Permission Denied using ftp cmd line avonsteen Classic ASP Components 0 May 11th, 2005 08:50 AM
Running cmd line .EXE through PHP geolast PHP How-To 2 January 6th, 2005 02:34 PM
ASP.Net Code Behind & In-Line Coding vinod_pawar1 General .NET 4 October 8th, 2004 02:33 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.