How to Publish a Website Using PSAKE

Is there a way to publish an asp.net web application using PSAKE, just like visual studio?

+8
psake publish
source share
3 answers

In Psake, you have an exec function to run programs. With this task / feature, you can create, compile, and publish your web application.

You can execute asp_compiler to create a project / solution

Exec { aspnet_compiler.exe } 

Refer to msdn site for exact syntax and parameters for aspnet_compiler.exe

I found an example that shows how to do this:

http://blog.developwithpassion.com/2008/10/30/interested-in-trading-in-your-nant-builds-a-teaser/

+3
source share

According to this post , here is another way to publish your web application. I used this method to publish the .asmx web service. The trick is _CopyWebApplication msbuild target, which makes redistributable files for your web application.

 # ...setup properties task PublishWebService -depends Compile { $output_dir = "$build_dir\$configuration\Web" $output_bin_dir = "$output_dir\bin\" msbuild $webservice_project_file /t:ResolveReferences /t:_CopyWebApplication /p:Configuration=$configuration /p:WebProjectOutputDir="..\$output_dir" /p:OutDir="..\$output_bin_dir" if (-not (Test-Path $web_service_inetpub_dir)) { mkdir $web_service_inetpub_dir } copy $output_dir\* -destination $web_service_inetpub_dir -recurse -force "Publish OK!" } 

See also this post for some information on setting up and tearing down IIS sites and application pools from your psake script.

UPDATE: I found the following commands to work a little better. The one I posted above does not properly apply web.config conversions.

 # ... msbuild /t:Rebuild /p:OutDir=..\$output_dir\ /p:Configuration=$build_configuration /p:UseWPP_CopyWebApplication=True /p:PipelineDependsOnBuild=False /p:TrackFileAccess=false "$web_app_project_file" # ... copy $output_dir\_PublishedWebsites\$web_app_project_name\* -destination $inetpub_dir -recurse -force 
+5
source share

I am using a .net 4.0 build and tools for web deployment in IIS. Here is a snippet of code that can be used in PSake:

https://gist.github.com/579086

+4
source share

Source: https://habr.com/ru/post/651373/


All Articles