How to run MSBuild file after TFS done building successfully? - visual-studio-2013

So, i recently set up an TFS build server, server could build and test, not problems there, however i found out that MsBuild cant publish to ftp directly. so i search on the internet, of what exactly i can do to solve my problem.
I found ms build tasks extension which have possibility to publish files to ftp. The problem i am facing right now is that i cant really figure out how to use it. I am using default build process template, with few changes. I dont understand if i have to change that template, or i have to write a brand new template? Or do i have to change in VS project file? or how do i get started? I never worked with MSBuild before. So the question is, how do i get started?
There are plenty information on the internet, but i couldnt find a plain dummy explanation of how to integrate this library and make it work together with TFS.

You would be better to love your ftp your to PowerShell.
If you use the TfvcTemplate.12.xaml you should see a post test script location. Here you can specify a PowerShell to fun after your build has finished and tests have passed. This would be much easeyer to support long term.

Related

How do I include a file dynamically into a TeamCity build

I am fairly new to TeamCity and have recently been tasked with creating various builds, which I have done with no real issues.
What I am trying to do now though is include an external text file into the build output.
The external text file will be received from a service call made during the build.
These are my intended build steps:
Check out solution.
Restore packages.
Run tests.
Call web service with a configurable parameter and receive text file back.
Include text file in build.
Deploy.
Steps 1,2,3 and 6 are covered.
What are my options here? I must confess I do not really know where to begin.
I've spent some time today googling but it has been tricky getting the correct search term to return information on what I am trying to achieve.
I've seen some confusing articles on a 'meta runner'.
Any pointers to get me started in the right direction would be much appreciated.
Thanks.
Use a TeamCity command line build step - https://confluence.jetbrains.com/display/TCD9/Command+Line
I assume you are using build steps for all the other steps you listed so this is simply another of those.
The command line process would run somewhere under your checkout folder and thus anything it downloads would be made available as an artifact for your build

tfs build can't find resx files

I am trying to use automated builds and deployments to our test IIS web server, however, as of recently, for some reason, the builds are failing with reasons for:
Cannot find Errors.resx
Errors.resx is a file within the project, and it's checked in. Even the Publish option from VS2010 works fine.
Has anyone come across this before?
I had something similar to that, I think I ended up manually patching a value in a resource file in notepad++
see msdn link

how should I go about replicating VS2010's Publish command?

I'm trying to build a publish script that doesn't use VS2010 -- I want it to be automated and in powershell (may use Psake soon). The biggest issue that I run into is that a project that will build and publish fine in VS2010 will either not build or not publish via the msbuild command. The closest I can get is (anonymized code):
msbuild /p:OutDir=c:\temp\publish\staging\myProj\myProj_1481\;Configuration=Debug;UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False C:\TEMP\export\myProj\1481\src\myProj.com\myProj.csproj
That one is failing for a Could not find file error in one of the DLLs. Naturally it publishes fine from VS2010. Is there some sort of recursion that I need to do? I'm burning up quite a bit of time on this one particular portion of my script -- the one part I have the least control over.
Requirements:
if the proj will build in VS2010 I shouldn't need to modify the csproj file -- I don't want to hand this script off to someone else and have them stick in "fix your csproj" land for hours per project
have to be able to script it entirely at the command line
hopefully no additional installs needed
Related:
Trying to Build and Publish Asp.net website from command line using aspnet_compiler (old)
_CopyWebApplication with web.config transformations (didn't fix my issue)

I've been asked to deploy, but I cant make the magic happen

I've added a couple of lines to a file, let's say it builds to be foo.dll. It's part of more then one dll file, but it's the core dll. What I did was that I added a couple of lines so it should add some log data to the database. It should not affect any other files what so ever.
So i tried to deploy it. We don't have the magical one click deploy, we are just copying the right files to the right place.
So now, since i have a change in foo.dll, i thought for myself that i just could copy foo.dll and the server would be happy.
I was wrong. Browsing the website i now get "Generic Errors", dont know what that is. I've also tried to copy all the new dll files (4 i total) but that did not solve the problem either.
The error it gives are
Http Error 404.0 not found
Module: ISS Web Core
Notification: MapRequestHandler
Handler: Static File
Error Code: 0x80070002
replacing the new foo.dll with the old one solves the problem. and i've tried to restart the webserver. :-(
I asume you have "published" and not just "compiled" your Web?
You also need to take care off the "Solution Configurations": Debug and Release.
In a normal publish process you would change the configuration to release and publish your project into another folder.
After you have done that you just need to collect the desired files and upload them.
Keep in mind that you need the newest version of you web project. Maybe there are some changes online that your local project hasn'T. This would cause such problems.
We don't have the magical one click deploy
Why not? It's not magic, and it's pretty easy to set up. Get any continuous integration software (I would recommend BuildMaster since I am a developer for it and it's free now) and you'll never have this problem again.

Recommend a Visual Studio FTP deployment plug-in

we've recently stumbled across the excellent Dispatch for ASP FTP deployment plug in. It looks great apart from one thing: It doesn't work with Visual Studio 2010, at least for us, anyway. (It's supposed to work fine.)
(Yes, we've tried everything: We've managed to get Dispatch working for another FTP site, but not the main one we regularly deploy to. We have managed to connect to our main site through FileZilla FTP, so the site itself is configured correctly. All settings have been triple checked, but the software still throws up weird errors (always to do with its internal libraries).)
So does anyone know of any other comparable FTP-based, deployment plug-in for Visual Studio?
Here's what Dispatch does (and so any suggested replacement must do):
Monitor any altered files
in the project. When a file is
changed, it's added to a list of
files to be deployed.
To deploy these
files to the live site, all we need
to do is click "Upload" and the plugin will
connect via FTP to our live site and
upload the selected files.
We can filter out
any filenames we don't want to be
monitored/uploaded (e.g. .cs or
web.config or /Images/, etc.)
I think that's all the features that we need. Thanks for any suggestions!
Note: If you're wondering why we need such a service, it's because we deploy many site changes over the course of a single day. Publishing the entire project to a folder, zipping it up, then FTPing that zip file, only to have to unzip it, and then install the entire project into the live wwwroot takes far too long. With Dispatch you're able to upload individual files in a single click.
After much back and forth between me and the creator of Dispatch, we managed to narrow down the problem to the library he was using (Rebex FTP). I posted a question about the issue on the Rebex forums, and it was revealed that their software might have a bug with IIS7.5. They suggested a quick hack/fix, which I tested and discovered worked.
Mr. Dispatch then quickly implemented this hack/fix into his software, and lo! I had a fully working copy of Dispatch... So no need for a replacement any more!
(And from what I've seen, there isn't even any other plug-ins offering this functionality, so it's just as well.)
Just an update - Dispatch does not work with VS 2013 so if you have VS 2012 with Dispatch installed, Keep it. Also the website is gone so it looks like all development has ceased. I have been using Dispatch since VS2005 and it has been great for just sending single files up when I need to. Too bad it is gone.
I built a very simple one for myself - you right click the file in Solution Explorer and it then uploads that file based on a settings file you create.
It's super crude but it works and the source is there to make it better if you like -
https://github.com/garazy/vs-2017-ftp-upload
Big enhancements have been added to VS2008, VS2010, VS2012. Below is the article. I found that Microsoft did all the above while I was searching. Since this came up high in what I was searching, thought should share this knowledge.
Deploy a Web Application Project Using One-Click Publish Without Web Deploy

Resources