简体   繁体   English

尝试使用aspnet_compiler从命令行构建和发布Asp.net网站

[英]Trying to Build and Publish Asp.net website from command line using aspnet_compiler

I am trying this. 我正在尝试这个。 I have built asp.net website. 我已经建立了asp.net网站。 When I publish to IIS through VS2008 it works fine. 当我通过VS2008发布到IIS时,它工作正常。 Lets say my site is at c:\\projects\\Website1\\ I want to publish it to c:\\Inetpub\\wwwroot\\WebsiteOne 让我说我的网站是在c:\\ projects \\ Website1 \\我想将它发布到c:\\ Inetpub \\ wwwroot \\ WebsiteOne

I am trying to mimic publish from studio. 我想模仿出版工作室的出版物。 That is publish and remove anything that is in side. 那就是发布并删除任何内容。

I tried this: aspnet_compiler -v/WebsiteOne -fc:\\Inetpub\\wwwroot\\WebsiteOne 我试过这个:aspnet_compiler -v / WebsiteOne -fc:\\ Inetpub \\ wwwroot \\ WebsiteOne

Error: error ASPRUNTIME: The precompilation target directory (c:\\Inetpub\\wwwroot\\WebsiteOne) cannot be in the same tree as the source application directory (c:\\inetpub\\wwwroot\\WebsiteOne). 错误:错误ASPRUNTIME:预编译目标目录(c:\\ Inetpub \\ wwwroot \\ WebsiteOne)不能与源应用程序目录(c:\\ inetpub \\ wwwroot \\ WebsiteOne)位于同一树中。

When I tried this: aspnet_compiler -v/WebsiteOne 当我尝试这个:aspnet_compiler -v / WebsiteOne

I get error This application is already precompiled. 我收到错误此应用程序已经预编译。

Anyone who could give me an insight on how to do compile line building and publishing of website 任何能够让我了解如何编译线构建和网站发布的人

Thanks 谢谢

I solved the problem in meantime. 我在此期间解决了这个问题。 You just need to pass the physical path, because it picks up one from IIS 您只需要传递物理路径,因为它从IIS中获取一个

aspnet_compiler -v /WebsiteOne -p c:\projects\Website1 -f c:\Inetpub\wwwroot\WebsiteOne 

in case someone else encountered same problem.. 以防其他人遇到同样的问题..

Also, you might consider using MSBuild on your solution file, and using the Publish target. 此外,您可以考虑在解决方案文件上使用MSBuild,并使用“发布”目标。

That's what VStudio is doing under the covers anyway. 无论如何,这就是VStudio正在做的事情。 :-) :-)

From http://johnnycoder.com/blog/2008/01/29/getting-started-with-cruisecontrolnet/ 来自http://johnnycoder.com/blog/2008/01/29/getting-started-with-cruisecontrolnet/

I have pasted the information, in case his blog ever goes down. 我已经粘贴了这些信息,以防他的博客发生故障。

  1. For web solutions, update the TargetPath for the Debug and/or Release build of the application to be outside of the source application directory. 对于Web解决方案,请将应用程序的Debug和/或Release版本的TargetPath更新为源应用程序目录之外。 Otherwise, you will receive the following error: 否则,您将收到以下错误:

ASPNETCOMPILER : error ASPRUNTIME: The precompilation target directory cannot be in the same tree as the source application directory. ASPNETCOMPILER:错误ASPRUNTIME:预编译目标目录不能与源应用程序目录位于同一树中。

This can be done by modifying the following in the solution file: 这可以通过修改解决方案文件中的以下内容来完成:

Debug.AspNetCompiler.TargetPath = “c:\ccnet\PrecompiledWeb\SampleWeb\”
Release.AspNetCompiler.TargetPath = “c:\ccnet\PrecompiledWeb\SampleWeb\”

Alternative, one may update the Output location found in the application MSBuild properties. 或者,可以更新应用程序MSBuild属性中找到的输出位置。

You may be wondering why an updated solution won't be updated with the next scheduled build. 您可能想知道为什么更新的解决方案不会使用下一个计划的构建进行更新。 As it works out (and makes sense) only changes which are applied to source control are pulled onto the build box. 当它成功(并且有意义)时,只有应用于源代码控制的更改会被拉到构建框中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM