TFS copy build output to source control - visual-studio-2012

I have been working with a TFS project that supports copying build output to source control. If I open the build definition, this is under "Build Defaults". There is an option to copy build output to a source control folder.
I have just installed TFS Server 2013 (with update 2) and I want to use this feature with a new Team Project. However, if I create new build in VS 2012 or VS 2013 on the new server, I am not given the option to copy build output to source control. What gives?
I am not looking for a workaround, I want to know what to change so that my server acts like the first one I described. Thanks!
Screenshots of what I'm talking about: http://imgur.com/a/mhDNQ

This was a feature that was temporarily present in TFS, but I believe has since been removed. If I recall it was put in there specifically to support the cloud-hosted elastic build servers which didn't have access to network shares to drop the builds in.
Most people recommend against putting your build outputs into TFS. The best approach is to publish them to a NuGet feed.
In any case if you want to put your build outputs into TFS (or a NuGet feed) you'll have to modify the build workflow to do that yourself.

Open a new build definition > process.
Under template select new and you should be able to choose project and folder. Find your original template and link it. Your option should appear.

In TFS 2013 this has changed to be "store drops in TFS". When you select this option the drop I'd stored in a new inversioned store that you can access.
While you can easily get the files out as indecision or zips the built in tools like release management do not support it yet. I would recommend that you use this option but publish your assets to a nugget repository.
If your TFS is available online (VSO or https) then you can use MyGet to dynamically load the nugget packages that you are publish and make them available on a feed.
http://docs.myget.org/docs/how-to/use-tfs-online-git-with-myget-build-services

Related

Azure can't find my TFS repositories

I have created a new app service on Azure, that i want to connect to an existing project on my TFS.
The problem is, when i choose Continuous Delivery -> Source and selects Visual Studio Team Service and selects the correct project, it says that there is "No repositories found".
What am i missing?
And as you can see, there should be a repository:
It looks to me like you are following the instruction for the new CD services that support Git only: https://www.visualstudio.com/en-us/docs/release/examples/azure/continuous-to-app-service
If you are still using TFVC you may need to follow the old 2013 instructions: https://learn.microsoft.com/en-us/azure/cloud-services/cloud-services-continuous-delivery-use-vso
If you want to move to Git to take advantage of this and other features then you can migrate using the Git-TFS tools on GitHub. Or even better, you can start from scratch and ditch binaries...

Create separate assembly for each page in TFS Build 2012 defination

I am working on creating build from TFS 2012. I am able to generate build from TFS build templates but problem is that my website(ASPX pages), I am using after generating build is not creating separate dll for individual page.
But If I generate build from VS2012 I can generate build with separate assembly for individual pages.I can see this option when I click on publish and configure.
But how to have same option in Tfs Build templates ?? I have searched for MSbuild arguments and didn't find anything related to that
The best thing for us was... change to Jenkins and use make.
But seriously -> you can watch what changes in csproj/sln. Then most of options in this file are switches in MsBuild.
Check:
http://www.kunal-chowdhury.com/2013/05/how-to-auto-deploy-after-build-in-tfs.html
http://www.asp.net/web-forms/overview/deployment/configuring-team-foundation-server-for-web-deployment/configuring-team-foundation-server-for-web-deployment
The settings for "Create a separate assembly for each page and control" is saved in the publish profile with following format:
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<WDPMergeOption>CreateSeparateAssembly</WDPMergeOption>
So you can create a publish profile with this setting and specify the publish profile in TFS Build Definition.

TFS: Automated publish a folder to Azure website

I am trying to create automated build to publish a folder with files onto Azure web-site. And I cannot accomplish this.
I am NOT publishing a solution (.sln), but rather a folder with files. I am using VS2013 and Visual Studio Online.
I have experience with TFS web publishing, so I published solutions many times.
So, what I did so far:
Created an MSBuild build.xml file that just copies files from the folder to the output.
Created a build definition based on AzureContinuousDeployment.11.xaml
Specified build.xml in my build definition, Process tab, in "Solution to build" parameter:
If I build my project, it is correctly built, files are copied to the output, etc (I can verify it by opening drop location, all files are there).
Then, I:
Created a web-site in Azure, linked it to my TFS subscription.
Downloaded a publish profile (.PublishSettings from a web-site).
Created a Web publish profile (.pubxml) in Visual Studio based on .PublishSettings file).
Specified Web Deploy Publish Profile and Deployment Settings Name:
But now I am getting an error during build:
Exception Message: Please specify a Visual Studio Solution (.sln) to build. (type BuildFromSolutionException)
So it asks me for a Visual Studio solution, but earlier it worked perfectly with MSBuild file (after step 3).
I tried to rename my .xml to .sln (probably it is not what I should have done), and build now says "There was no Windows Azure project (.ccproj) detected in the solution. Continuous delivery to an Azure Cloud Service requires an Azure project. (type CCProjNotFoundException)"
If I don't specify "Deployment Settings Name", build completes without errors, but again no publishing to Azure.
So, the question is, how to publish a custom MSBuild build, without a solution, onto Azure? Is TFS continuous Azure publishing for Solutions only? I expect it to be agile, like I published folders from Local Git to Web-site without any hassle.
What should I do?
There are a few confused ideas in your question. Fits, there is no relationship between and automated build and Git. You are using Team Foundation Build to run the workflow of deployment. It is the workflow that is not working for you. In effect the build and deployment script. In fact the script you are using works with both Git and TFVC so that is not the issue.
That specific script is designed specifically for building an azure project that is then continuously delivers to Azure and you likley can't use it as you are. You can however create another script and use that. I would suggest you try instead to use the Default build script and use a powershell script within the build to collect the files and then push them to Azure.
If you want to go a little more advanced you could create a copy of the default and make one that does not require MSBuild at all.

TFS 2012 - Referencing external projects by Label

Okay, I have a couple inquiries:
1 - Let's say I have a solution that references several external projects. I want to reference specific Labels (that represent stable versions) on those external projects. I know that you can do this by doing a Get Specific Version by Label on those projects. But once you've done that, is there a convenient way to do a Get on the whole solution, and have it preserve all of the specific versions?
Ultimately, I would like to do a single Get and have it get latest where that is applicable and get specific versions where that is applicable. It seems frustrating to have to do separate Gets on all the projects.
2 - Is it possible to build binaries from labels? When an external project is a stable version that isn't going to change, it makes sense to just reference the binary. When you create a label and build it, does it generate binaries in a specific location for that label that can be referenced?
On your first question: While TFS allows you to grab sources by Label, there is no way to setup a a workspace configuration that is bound to a specific Label or Changeset for a specific path. The only thing I can think of would be to create a batch file which fetches the latest version:
tf get $/Project/Sources /Version:T /recusive
tf get $/Project/ComponentA /version:LMyLabelName1 /recursive
tf get $/Project/ComponentB /version:LMyLabelName2 /recursive
The way forward to do this is to publish your external references to a NuGet repository (can be your own) and then configure NuGet to get a specific version. A CI build can publish a new version to your NuGet server. And you can setup your own server so that you don't need to publish all your binaries to a public server.
On your second question: yes you can build by label in the Queue Build screen you can setup the version to build which will be built:
You can specify a Changeset number (C######), Label (LLabelname) etc. Any version spec will do (see the commandline docs for a explanation on version specs).
By default, no easy referencable name is generated if you build by label. I suspect that some clever build customization will allow you to drop the build output in a predefined folder based on the label name, but there is no such out-of-the-box functionality.

Specify which Publish script to use on build?

How do I have SSDT run my publish script when I build my solution file?
If you:
1) Right click on your solution
2) Click Configration Properties
3) Click Configuration
I can see the database project and where it is checked to deploy on build, it does not let me specify what publish script to use.
As far as I know this isn't possible out of the box.
Why? They are two very different things.
Building (if you were to think of it as code) compiles and checks, producing artefacts. For .NET code those artefacts are DLL's/.exe etc. For .sqlproj it's the .dacpac etc that turn up in /sql/[Build Configuration Name].
Publishing is akin to Deploying if you were talking .NET code. Building won't include Publishing as an action.
Ironically, a Publish action also Builds the solution, so my suggestion would instead be to consider one of the following:
Publish the project (right click Publish, or double click your chosen .publish.xml file) whenever you want to build.
Use the Post-Build command line in the project Properties to call sqlpackage.exe to deploy your newly compiled .dacpac with your specified .publish.xml profile - but note that this will also impact your use of the Publish action from within Visual Studio as a Publish builds and then publishes (so you'd end up publishing twice).
Depending on your comfort levels/if you are a command-line fan, then use the command line (bash file? Powershell?) to call msbuild followed by sqlpackage.exe. Whenever you want to build, run your command in cmd.exe.
Similar to #3, add a menu item to the Tools menu that would do exactly the same thing (msbuild followed by sqlpackage deployment) but from within Visual Studio itself.
Look at a Continuous Integration model (TFS/TeamCity/Bamboo/Jenkins and about 3000-others), which could build and deploy for you automatically with every change - either on another server, or running locally (I put this in without knowing your scenario, so may be very much unsuitable to solve your problem).

Resources