I am trying to set up TeamCity to build and deploy an ASP.NET MVC application.
I have the setup running successfully on other servers using TeamCity 4.5, but the new server is running TeamCity 6, and I am having trouble getting it to work as expected.
TeamCity manages to get the files from source control, and the project (Visual Studio Solution 2008 set to "Build") builds and outputs the necessary files as expected. The problem seems to be with my artifact paths, as the output files are not copied to the website folder.
My solution consists of dozen projects, of which the "Web" project is the interesting one in this case. The build checkout directory is C:\TeamCity\buildAgent\work\7da320cebf0ee541, and the "Web"-project is found in C:\TeamCity\buildAgent\work\7da320cebf0ee541\Web
I have set up my build configuration with the following artifact paths (relative from checkout directory to the folder containing the website):
Web/bin=>../../../../inetpub/wwwroot/staging/bin
Web/Content=>../../../../inetpub/wwwroot/staging/Content
Web/Views=>../../../../inetpub/wwwroot/staging/Views
Web/Media=>../../../../inetpub/wwwroot/staging/Media
Web/*.aspx=>../../../../inetpub/wwwroot/staging
Web/*.asax=>../../.开发者_开发技巧./../inetpub/wwwroot/staging
(I've tried with more ../ just in case, but it didn't make a difference).
This is the output I get from the log
[19:35:29]: Publishing artifacts (1s) [19:35:29]: [Publishing artifacts] Paths to publish: [Web/bin=>../../../../inetpub/wwwroot/staging/bin, Web/Content=>../../../../inetpub/wwwroot/staging/Content, Web/obj=>../../../../inetpub/wwwroot/staging/obj, Web/Views=>../../../../inetpub/wwwroot/staging/Views, Web/Media=>../../../../inetpub/wwwroot/staging/Media, Web/.aspx=>../../../../inetpub/wwwroot/staging, Web/.asax=>../../../../inetpub/wwwroot/staging, teamcity-info.xml] [19:35:30]: [Publishing artifacts] Sending files [19:35:32]: Build finished
Logs from some of the other servers running TeamCity 4.5 uses a different format, with a line for each of the artifacts being published, I'm not sure if this is relevant or only due to a different logging format.
Everything seems to be working, but no files are put in my website folder after a build, am I missing something here? Any help will be much appreciated :)
I've always used build scripts to handle this kind of process, since you're using TC6 you should be able to add a second build step after your VS.NET solution builder which performs the copy/move. MSBuild would probably be the preferred scripting method for doing this but you could use a simple console runner if you all you need to do is copy. Using a scripted approach you should be able to use an absolute path for the deployment directory which shouldn't be as fragile as relative paths.
Since 6.0, TeamCity doesn't allow to publish artifacts outside of the server's artifacts directory (for security reasons). I think this is your case.
In server logs (TeamCity/logs/teamcity-server.log) there should be a related warning started with "Attempting to publish artifact outside of build artifacts directory".
If you wan't to publish files to some particular location, you should probably create a separate build step which would send files by FTP or something to desired location.
You may also want to vote for http://youtrack.jetbrains.net/issue/TW-1558
Why not take a look at Albacorebuild. I'm using it to control the build process, running tests, creating ZIP's and NuGet packages. More info and examples here: http://daniel.wertheim.se/2011/07/14/continuous-integration-using-teamcity-rake-albacore-github-and-nunit-for-net-%E2%80%93-part-3/
精彩评论