从命令行复制VS2008“发布网站”(Replicate VS2008 “Publish Web Site” from command line)

编程入门 行业动态 更新时间:2024-10-24 08:24:01
命令行复制VS2008“发布网站”(Replicate VS2008 “Publish Web Site” from command line)

我试图在Visual Studio 2008中以构建脚本复制此对话的确切功能: alt text http://i41.tinypic.com/1osl1f.png

这是一个ASP.NET 网站 ,而不是Web 应用程序

我已经在谷歌搜索,并提出了相当多的涉及MSBuild的东西,但这一切似乎都关注ASP.NET Web应用程序的解决方案:

http://www.driebier.net/post/Using-MSBuild-to-deploy-visual-studio-2005-web-applications.aspx http://blog.donnfelker.com/post/TFS-Build-Not-Publishing织网,Applications.aspx

这篇文章似乎与ASP.NET网站有关,但是我发现我尝试使用这些建议来构建错误:

C:\dev\T&A>msbuild /t:_CopyWebApplication /property:OutDir=c:\temp\taweb\ /prope rty:WebProjectOutputDir=c:\temp\taweb\ Microsoft (R) Build Engine Version 3.5.30729.1 [Microsoft .NET Framework, Version 2.0.50727.3074] Copyright (C) Microsoft Corporation 2007. All rights reserved. Build started 22/04/2009 11:50:42. Project "C:\dev\T&A\TAWeb.sln" on node 0 (_CopyWebApplication target(s)). Building solution configuration "Debug|.NET". C:\dev\T&A\TAWeb.sln : error MSB4057: The target "_CopyWebApplication" does not exist in the project. Done Building Project "C:\dev\T&A\TAWeb.sln" (_CopyWebApplication target(s)) -- FAILED. Build FAILED. "C:\dev\T&A\TAWeb.sln" (_CopyWebApplication target) (1) -> C:\dev\T&A\TAWeb.sln : error MSB4057: The target "_CopyWebApplication" does n ot exist in the project. 0 Warning(s) 1 Error(s) Time Elapsed 00:00:00.06

我试图发布的解决方案(继承而不是我自己的)没有.csproj文件(我可以从C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v9.0 \导入_CopyWebApplication目标web应用\ Microsoft.WebApplication.targets)

也许这是Visual Studio 2005/2008的区别?

无论如何,我觉得我要走错路。

基本上我只需要实现上述对话所做的,但是从命令行。

非常感谢

I am trying to replicate the exact functionality of this dialogue in Visual Studio 2008 in a build script:

This is an ASP.NET web site, not a web application.

I have Googled around this and turned up quite a bit of stuff involving MSBuild, but this all seems to concern solutions laid out as ASP.NET Web Applications:

http://www.driebier.net/post/Using-MSBuild-to-deploy-visual-studio-2005-web-applications.aspx http://blog.donnfelker.com/post/TFS-Build-Not-Publishing-Web-Applications.aspx

This article seems to be relevant to ASP.NET Web Sites, but I find that I'm getting an error when trying to build using those suggestions:

C:\dev\T&A>msbuild /t:_CopyWebApplication /property:OutDir=c:\temp\taweb\ /prope rty:WebProjectOutputDir=c:\temp\taweb\ Microsoft (R) Build Engine Version 3.5.30729.1 [Microsoft .NET Framework, Version 2.0.50727.3074] Copyright (C) Microsoft Corporation 2007. All rights reserved. Build started 22/04/2009 11:50:42. Project "C:\dev\T&A\TAWeb.sln" on node 0 (_CopyWebApplication target(s)). Building solution configuration "Debug|.NET". C:\dev\T&A\TAWeb.sln : error MSB4057: The target "_CopyWebApplication" does not exist in the project. Done Building Project "C:\dev\T&A\TAWeb.sln" (_CopyWebApplication target(s)) -- FAILED. Build FAILED. "C:\dev\T&A\TAWeb.sln" (_CopyWebApplication target) (1) -> C:\dev\T&A\TAWeb.sln : error MSB4057: The target "_CopyWebApplication" does n ot exist in the project. 0 Warning(s) 1 Error(s) Time Elapsed 00:00:00.06

The solution I'm trying to publish (inherited, not my own) doesn't have .csproj files (where I could import the _CopyWebApplication target from C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets)

Perhaps this is a Visual Studio 2005/2008 difference?

Anyway, I feel that I'm going down the wrong path there.

Essentially I just need to achieve exactly what the above dialogue does, but from the command line.

Thanks very much

最满意答案

以下命令将使用默认设置重复“ 发布网站”对话框。

使用默认设置发布网站的命令

aspnet_compiler -nologo -v / -p "C:\WebSite1" -u "C:\TargetPath"

参考

1)查看社区内容,标题为“ 想要发布站点,但是没有Visual Studio然后...” http://msdn.microsoft.com/en-us/library/20yh9f1b(classic).aspx 。

Microsoft Visual Studio 2005> Visual Studio 2005命令提示符 Microsoft Visual Studio 2008> Visual Studio 2008命令提示符 Microsoft .NET Framework SDK v2.0> SDK命令提示符

2)请参阅“ASP.NET编译工具(Aspnet_compiler.exe)”, 网址为http://msdn.microsoft.com/en-us/library/ms229863.aspx 。

3)以下摘录摘录:使用XCOPY部署ASP.NET Web应用程序 http://msdn.microsoft.com/en-us/library/f735abw9.aspx

作为使用所有版本的.NET Framework支持的XCOPY命令行工具的替代方法,您可以使用位于%SystemRoot%\ Microsoft.NET \ Framework \ version 2或更高版本的新.NET Framework 2.0工具\ Aspnet_compiler.exe来编译和部署Web应用程序。 有关更多信息,请参阅ASP.NET编译工具(Aspnet_compiler.exe) 。

4)以下摘录如何:在http://msdn.microsoft.com/en-us/library/ms227976.aspx中 预编译ASP.NET网站进行部署

如果您的网站不是Internet信息服务(IIS)应用程序,因此在IIS元数据库中没有条目,则为-v开关使用以下值。

aspnet_compiler -p physicalOrRelativePath -v / targetPath

在这种情况下,physicalOrRelativePath参数是指网站文件所在的完全限定目录路径,或相对于当前目录的路径。 physicalOrRelativePath参数中允许使用句点(。)。 -v开关指定编译器将用于解析应用程序根引用的根(例如,使用波形符号(〜)运算符)。 当为-v开关指定/的值时,编译器将使用物理路径作为根解析路径。

The following command duplicates the Publish Web Site dialog with default settings.

Command for Publish Web Site with Default Settings

aspnet_compiler -nologo -v / -p "C:\WebSite1" -u "C:\TargetPath"

Reference

1) See Community Content titled You want Publish a site but you have not Visual Studio then... at http://msdn.microsoft.com/en-us/library/20yh9f1b(classic).aspx.

Microsoft Visual Studio 2005 > Visual Studio 2005 Command Prompt Microsoft Visual Studio 2008 > Visual Studio 2008 Command Prompt Microsoft .NET Framework SDK v2.0 > SDK Command Prompt

2) See "ASP.NET Compilation Tool (Aspnet_compiler.exe)" at http://msdn.microsoft.com/en-us/library/ms229863.aspx.

3) Following excerpt from Walkthrough: Deploying an ASP.NET Web Application Using XCOPY at http://msdn.microsoft.com/en-us/library/f735abw9.aspx

As an alternative to using the XCOPY command-line tool, which is supported by all versions of the .NET Framework, you can use the new .NET Framework 2.0 tool located at %SystemRoot%\Microsoft.NET\Framework\version 2 or later\Aspnet_compiler.exe to compile and deploy your Web application. For more information, see ASP.NET Compilation Tool (Aspnet_compiler.exe).

4) Following excerpt from How to: Precompile ASP.NET Web Sites for Deployment at http://msdn.microsoft.com/en-us/library/ms227976.aspx.

If your Web site is not an Internet Information Services (IIS) application and therefore has no entry in the IIS metabase, used the following value for the -v switch.

aspnet_compiler -p physicalOrRelativePath -v / targetPath

In this case, the physicalOrRelativePath parameter refers to the fully qualified directory path in which the Web site files are located, or a path relative to the current directory. The period (.) operator is allowed in the physicalOrRelativePath parameter. The -v switch specifies a root that the compiler will use to resolve application-root references (for example, with the tilde (~) operator). When you specify the value of / for the -v switch the compiler will resolve the paths using the physical path as the root.

更多推荐

NET,_CopyWebApplication,Microsoft,电脑培训,计算机培训,IT培训"/> <meta name=&

本文发布于:2023-04-29 04:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1334566.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令行   网站   Replicate   Publish   Site

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!