MSBuild or TFSBuild Conditional for One Project? - tfs

I have a long-time-to-build (setup) project in a Visual Studio 2010 Solution. It is set not to build in the Solution configuration. That way, when a developer builds locally they are not burdened with waiting for the setup to compile in Visual Studio.
However, I am looking for a way to change the configuration in tfsbuild or msbuild files so whenever things are built on the server, the setup project is always built, regardless of what the setting might be when a developer checks in their solution. TFS 2008 is the source control system but just a plain Server 2008 (with devenv fully installed) is the build server.
All clues appreciated.
Thanks.

I would suggest creating a new configuration in your solution, named e.g. Release_Setup, that way you have seperate configurations for developer and setup build (note that developers can choose that config and build everything locally if they so choose, which is quite nice when all Build agents are busy and you want to check that everything's fine).
In Solution Properties->Configuration Properties->Configuration you can even tell it to build the normal Release Configuration and still choose which projects to build and which to exclude.
Hope this helps. I haven't actually tested this, so please try it and comment back if there are any problems or this doesn't solve your specific question.

Related

Team Foundation Server 2017 Build and Release

I'm trying to setup TFS 2017 in my company.
Everything is fine until I came to release tab.
I'm little bit confused.
How on earth I need to deploy everything to my local server. I read a lot of articles regarding this but still confused how to use artifacts.
Right now I have setted up source control and created build definition and stuck on release.
Anybody manage to setup release in TFS 2015 or 2017? Any help would be great!
I found this article that explains how to build and deploy web project on premise. Hope this will help somebody.
Need to use this arguments in Visual Studio Build task
/p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish
/p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True
/p:publishUrl=$(build.artifactstagingdirectory)\for-deploy\website
It will create in Artifacts folder with website that can be simply copied to remote machine in Release definition.
You should view artifacts as single deploy able packages, so if your application has a front end website and a database you can package them up the website as one artifact and the database as another during the build. When it comes to a release, your release could deploy the website to one server and the database to another or even the same server, the choice is yours. I tend to have development environments hosted on a single server but pre-production and production are load balanced, the only change from development to production is the name of the server to deploy the change to.

ClickOnce through TFS & Release Management

I have seen quite a few blogs around managing a ClickOnce application through TFS up to Visual Studio 2010. The process seems a little convoluted and so I cannot help but wonder if there has been any improvement with later versions of VS? I am using 2015 (VS, TFS & RM) so would love to hear of anyone has had more luck doing this on later versions.
Any help on the matter would be massively appreciated!
These settings worked for me :
/target:publish /p:PublishDir="$(build.artifactstagingdirectory)\\"/ /property:ApplicationVersion=1.0.0.$(Build.SourceVersion)
The $(Build.SourceVersion) variable will be the changeset / git commit id.
Then you can create a release to deploy this somewhere.
Create a website to deploy to.
Click Artifacts to select the artifact to deploy.
Select IIS Deployment to choose machines in a deployment group.
Click the menu icon highlighted to select the drop folder.
For further documentation about certificates + signing see other clickonce docs.
I think there's another option to create an html page, but you can just link to the .application file.
You could use the new build system vNext Build to achieve it. Just need to add Publish Build Artifacts step in the build process. You could write a PowerShell script, if you want to copy ClickOnce output to some directory like UNC path/IIS website folder. Here is a blog with detailed steps: Building ClickOnce apps using build vNext
If you still insist on using XAML build, this one will also meet your needs.

Build Server Will NOT Deploy certain apps

We recently upgraded to TFS2012 and now we have an MVC app and a WCF Service both built in VS2012 that WILL compile and build but will NOT deploy. Any ideas on what I should research? I read that MS now only allows deployment of certain types of files and web files are not of that type. Thanks so much for your time.
The default build processes in a standard on-premises TFS2012 installation do not do any deployment out of the box. Therefore in answer to your question I would personally look at the custom deployment steps that are happening and maybe put some additional logging in to identify the problem.
Often being able to remote desktop into the build server and then perform the steps that your build process would have taken is a good way to check things like this.
As the upgrade process usually involves re-installing the build agent my guess would be that it could be a permissions problem, maybe the build agent was installed as a different user to how it was running in the TFS 2010 configuration and that process/user does not have permissions to deploy the build. But that is just a guess - digging into the deployment steps that you added to your build process should help you track it down. Good luck!

TFS Build vs local build

I really don't understand the meaning of tfs build although MSDN provides many definitions.
For example, I have an asp.net project. If I passed the local build on my local machine and I checked in the code. Everything is fine.
I used to copy(publish) the code to the server, that's it.
Why we need tfs build? What is different between tfs build and local build. You might to say, there are build history that can be reverted to an old one. But I think that since code was versioned, we can checked it out and rebuild in the local machine and republish the project to the server.
When I was using TFS, I could run local builds on my local machine. And then when checking in code, TFS would automatically perform a build on the build server (this is specified via a build definition). In that case, the build server was located on the machine which housed the master copy of the TFS source repository.
It's not enough for each developer to build locally as they may not have the latest code. I think the point of a TFS build is that it will run a build on the build server which has all the latest code. I think the idea is that if the build is successful on the build server, then it's deemed safe to check in the code.
That's how I understood it anyway. It's useful if there are multiple developers working on a project. If there is only one developer on one machine, a separate build may not be necessary.
Did that answer your question or did I misunderstand?
The answer of CiaranG is indeed one way to look at it.
Also the TF Build server has the possibility to build your code with signed 3rd party DLL's and put everything in a place as it is every time a new version of your software. This can be then useful for testers that need to test your software and don't need development tools.
Besides CiaranG's description of the Continuous Integration benefits, there is also the security and cleanliness. Allowing production code to be built off of developer machines where there is a chance for virus/malware may be present and the configuration is not known/documented is just poor policy. By building it off a protected server, from which no surfing is ever done, you are ensuring a safe, clean, reproducible environment which adds professionalism to your code deployments. TFS also adds in reporting build metrics over time, accountability, and archiving.

What am I doing wrong - problems building using TFS 2012

I am trying to get the most basic configuration of TFS 2012 up and running.
So far I installed the TFS server using the simplest option (the 1st option in the installer - the one that comes with a bundled SQL express),
I configured the build service (1 controller, 1 agent, both on the TFS machine).
My project consists of 2 parts: a C#/silverlight part, and a C++ part.
After adding the silverlight prerequisites the C# project builds correctly.
However I can't get the C++ project to build.
I guess I am missing a prerequisite since I am getting the following errors:
C:\Builds\1\proj1\Client\src\Code\Client\proj\main (VC11).vcxproj
(19): The imported project "C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\v110\Microsoft.Cpp.Default.props" was
not found. Confirm that the path in the declaration is
correct, and that the file exists on disk.
Indeed, the TFS server does not have a "C:\Program Files (x86)\MSBuild\Microsoft.Cpp" folder (while my dev machine has one).
I installed the windows SDK, but that didn't help.
I saw on some posts that I need to install VS 2012 on the build machine. Is that correct? will VS express do?
I have been banging my head on this for the last 2 days, and any help would be appreciated.
Installing Visual Studio on your build server seems like a strange thing to do, but having been around the TFS block a bit, I have found it to be the simplest way to manage build servers.
You can copy the files manually from your dev machine to your build server, but if an update to visual studio comes out, you will need to figure out what has changed and make sure you update all those files too. These files typically include Targets files and associated dlls.
Also with all the extensions and packages that are available now, it is just easier to load Visual Studio on your build server and install the required packages than try to work out what is needed to replicate the functionality.
This was made very clear to me recently when Microsoft released ASP.Net and Web Tools 2012.2. This altered the publishing pipeline for Web Sites and Web Projects and I needed to use this in my TFS build. It was so much easier to just be able to log onto my build server, load Visual Studio and download the new update.
I would definitely support installing Visual Studio on your build server.

Resources