TeamCity MSBuild publishproj website

I have a website project that I am trying to deploy through TeamCity and WebDeploy.

Since this is a website and not a web application, I do not have a .vbproj or .csproj file.

I came to the conclusion from this post here that I need to create a .publishproj file, since MSbuild uses this as a build file.

However, when TeamCity calls MSBuild, it is released with the following error: -

Failed to start MSBuild.exe. Failed to detect default target(s) in the project file C:\TeamCity\buildAgent\work\d9dda73c7948f14a\MainSite\website.publishproj. Please define targets explicitly in the build configuration options on TeamCity Web UI. Project does not define DefaultTargets or InitialTargets.

I looked into the .publishproj file and not defined Target.

I also followed Troy Hunt. You are not using it for a web application, and it works great.

Can anyone suggest how do I deploy a website (not a web application) website from Team City?

+4
source share
3 answers

I have never worked with a website, not with a web project, so take it with salt.

website.publishprojIt seems to be created the moment you touch the Build> menu Publish Web Sitein Visual Studio and import Microsoft.WebSite.Publishing.targets, which is a good reason for this same file to be imported by your regular web projects ( Microsoft.WebApplication.targets) and both of which are imported Microsoft.Web.Publishing.targets.

, Visual Studio, DefaultTargets = Build OutputPath, Targets MSBuild , Microsoft.WebSite.Publishing.targets Microsoft.Web.Publishing.targets.

msbuild website.publishproj /t:Package /p:OutputPath=.\, .cmd .zip obj\Debug\Package. .cmd .zip msdeploy.exe -source:package=.zip /t:Build /p:DeployOnBuild=true, , , -.

Edit:

, - , , 2/3 PackageTmp\_PublishedWebsites, OutDir, OutputPath, PackageDestinationRoot , . - .csproj .targets, .

Edit:

, App_Data\PublishProfiles\Foo.pubxml, PublishProfileName/WebPublishProfileFile . .

Edit:

-, , 2012/2013, 2010 aspnet_compiler.

aspnet_compiler -v Foo -p . -f obj
msdeploy -verb:sync -source:iisApp=%CD%\obj -dest:iisApp="Default Web Site/foo"
+5

, - Rebuild Team City -.

+2

Build Step Visual Studio (sln) Package.

, :

\{Team City Working Directory}
  |
  |-- MyWebSite
  |    |-- App_Code
  |    |-- App_Data
  |    |    |
  |    |    \--PublishProfiles
  |    |         |
  |    |         \-- MyWebSite-Package.pubxml
  |    |
  |    | ... Other files and directories
  |    |
  |    |-- MyWebSite.publishproj
  |
  |-- SomeOtherLibraryProject
  |
  \-- MyWebSite.sln

, , :

/p:PublishProfile=MyWebSite\App_Data\PublishProfiles\MyWebSite-Package.pubxml

.\MyWebSite\MyWebSite.publishproj ; , :

/p:PublishProfile=App_Data\PublishProfiles\MyWebSite-Package.pubxml

The property PublishProfileis the relative path from the project or solution file specified in the File path property .

+1
source

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


All Articles