TFS 2012 - binary files are not generated when using automatic build - msbuild

I am newbie to TFS.
I am trying to automate process of build upon checking in the code in TFS.
I setup a Controller and an Agent. I created a new build definition and set a "build" and "drop" folder on c:.
I check in the code, expecting to see the generated dll files in "drop" folders. There's none, just "logs" folder. The "binaries" folder in "build" folder is also empty. Apparently the binaries are not being generated at all. How can I have MSBuild to generate the dll files?
They are generated when I compile the website locally on my development machine under "bin\" folder. The solution is comprised of two separate projects: "core" and "web" where "core" is referenced within "web".
Any thoughts?

What is the Summary showing of your build that ran? Or are there errors in your build? You can check the log of the build by opening the build in Visual Studio and then click View Log.

Related

TFS 2015 - Visual Studio Build step - control folder name of publish location

I am trying to set up a Build on an on premise Team Foundation Server 2015 using web.config transformations. The transformations work fine based on the build configuration I select. I have 3 build configurations: Debug, Release, and one that I created, called "Staging". I am trying to make it so I can re-use the same Build for different environments by setting the $(BuildConfiguration) variable at queue time. In my TFS build's "Visual Studio Build" step, when I set the $(BuildConfiguration) to "debug" the build is output to the agent folder like this: $(Build.SourcesDirectory)\projectFolder\obj\Debug\Package\PackageTmp. If I set it to "release", then it goes to $(Build.SourcesDirectory)\projectFolder\obj\Release\Package\PackageTmp. In both cases the Web.config file is transformed correctly.
However, if I set the build configuration to "Staging", the files are still placed in the "debug" folder $(Build.SourcesDirectory)\projectFolder\obj\Debug\Package\PackageTmp instead of a "Staging" folder. (Transformations also work fine in this case, and use the staging values)
This creates a problem in my "Copy Files" step. I have the "Source Folder" value in that step to $(Build.SourcesDirectory)\projectFolder\obj\ $(BuildConfiguration) \Package\PackageTmp, but when using "Staging", it cannot find the source folder because TFS is placing the build files in the "Debug" folder.
Is there a way to force TFS to place the built items (my web app files, basically) in a folder matching the build configuration parameter, in this case, "Staging"?
A note: It's best to not use web.config transformations, but to build once and allow your web.config to be transformed at deployment time (either by injecting appropriate values or by using MSDeploy parameters).
That said, you can control the output folder with the /p:OutDir= MSBuild argument.
I suspect, however, that you just need to open up your project settings in Visual Studio, go to the Build tab, and set an appropriately-named output folder there.

How do I get the the expected output from a TFS 2015 build (to match my XAML build)?

We just upgraded to TFS2015 (onsite) and I'm trying to set up a build that will do the same thing as my xaml builds but I can't seem to get the same files built. Here's a picture of the xaml output directory that I use to publish the site. To get this I navigate to the build folder then drill down to the _PublishedWebsites\BOTWSitecoreWeb folder:
Here's a picture of the solution explorer:
So as you can see BOTWSitecoreWeb is my startup project and it forms the basis for the website. So to publish this website I simply copy the folder: _PublishedWebsites\BOTWSitecoreWeb to my IIS directory. Here's what it looks like using the xaml build:
And if I drill down into the TFS2015 build output folder into the Drops/Source/sc/Website folder I get this, which has many more files and folders than what I'm expecting:
So my question is how can I get the same output that I currently get from my xaml builds from a TFS2015 build?
The bin folder has the same number of files, so that's a good start. Here's the bin folder from the xaml build:
And here's the bin folder from the TFS 2015 build. Notice that they both have 57 files, which I assume is a good thing!
Thanks in advance for any insight you can provide!
Ben
Update your build definition to below:
Add /p:DeployOnBuild=true /p:OutDir="$(build.artifactstagingdirectory)\\" arguments in Visual Studio Build step:
Change "Path to Publish" of "Publish Build Artifacts" task to "$(build.artifactstagingdirectory)_PublishedWebsites\ProjectName":
Save the build definition and queue a build, now you should get the same files published in drop folder like XAML build.
vNext build and XAML build, it's totally different technology. There won't be any automated ways of converting.
The new builds are based on a different architecture and run on a
completely different system.
So your situation is predictable, it's very hard to achieve a 100% conversion. Copy the folder in vNext will copy everything under the folder by default. Seems there are some customization during the copy or published in your XAML build which will return the result as above picture.
If you have heavily customized XAML builds and custom activities, you
can continue using those builds until you are ready to port your
business logic into scripts that can run in the new builds.
And you could also take a look at these series of articles how to upgrade from XAML to Build 2015 with minimal changes.

TFS build web application missing BIN for Wix Installer

I added into Solution(contains 30projects) Wix Installer, which is supposed to pack web service folder. Among files i want to pack is BIN file with plenty of dlls. On local with Release mode it works fine, however if i run TFS 2013 build definition over solution i get these:
C:\Builds\1\ABCD_02\WixInstaller\WSwixInstaller\filesToBeInstalled.wxs (97):
The system cannot find the file 'C:\Builds\1\ABCD_02\WixInstaller\WSwixInstaller\..\..\..\ABC WS\bin\ABC.Components.DataAccess.Lib.Utils.dll'.
I asked my colleage who administrate server and he told me that BIN folder isn't created in 'expected' location.
Now i don't have access to server and colleage is unreacheable, is here rule where binaries for all project/within solution are stored?
Update:
Somehow we overlook BIN folder - 'as configured' is and was set in definition however files still couldn't be found - problem was in build order(weirdly in VS2010 was correct) setting dependency wix project on target project helped - problem was that wix project was builded before target one.
Team Build creates uses a MsBuild parameter to redirect the build output of projects. If you need your Wix Installer to package up content that has been redirected, your installer script must be aware of this redirection happening.
The output structure of team build looks like
Build Agent Root
+- Unique build folder
+- src <- This is where your Wix project is placed
+- bin <- This is where Team Build redirects the project outputs to.
+- Test <- This is where Test Results are stored
This allows Team Build to figure out which outputs to copy to the drop location with a lot more accuracy, but it breaks any scripts that have hardcoded (or relative) paths to build outputs.
There is hope though, you can use the $(OutDir) or $(OutputPath) parameter to find the location Team Build has been configured to drop your binaries. You can use the '$(BuildingInsideVisualStudio)'=='' and/or '$(TeamBuildConstants)'=='' to detect whether your Wix Script runs in Visual Studio or in Team Build.
That way you can define multiple source locations for your Wix packages or to set the base directory to a certain value and use that variable in your wix scripts.
Or if you simply want your team build to match your bin structure when running in visual studio, set the 'output location' parameter in your build definition to 'as configured' - see this link for details:
http://blog.stangroome.com/2014/02/10/override-the-tfs-team-build-outdir-property-in-tfs-2013/

Visual Studio 2013 Publish issue

I converted a VS2010 ASP.Net MVC3 project to VS2013 MVC4. Now when I publish, it is copying the contents of my project to the bin folder.
I can't understand what I did to make it do this..How do I fix it so it doesn't do it?
Your files are incorrectly set to copy to the output folder (\bin) during build. Make sure that the Copy To Output setting on each file is set to Do Not Copy.
Normally, you don't need to copy much of anything to your bin folder. When publishing, all of the content pages (*.aspx, *.html, *.css, etc) will get picked up by publish just by existing in the project. This is determined by the Build Action being set to Content. (Note: you can exclude files by setting the Build Action to None)
For code files, there's 2 ways it could go. in a Web Application project (which MVC is) most code files, such as controllers, models, or code behind files in WebForms, are compiled into your site's DLL already. These have Build Action = Compile, meaning they get compiled up front and don't need to be included in the publish. The exception to this is files in App_Code, which are deployed to your site (Build Action = Content) and compiled at runtime. You can also choose to pre-compile your site in the publish settings (Settings -> File Publish Options -> Precompile during publishing), which will process the App_Code files automatically (i.e. you can leave them as Build Action = Content and VS will compile them and publish the output instead).

Teambuild not copying XAP fiesl to _PublishedWebsites

I have a TFS build for sivelright and it copies all the files in the web project to _PublishedWebsites, except the xap file. Error is
Web.csproj error MSB3021: Unable to copy file "Some.xap" to "c:\somewhere\Some.xap" Could not find file "Some.xap".
What it is trying to do, from where it is trying to copy and why it is failing?
Make sure your projects are built in the right order in your TFS Build Definition (Build Definition, Process, Required, Project to Build).