TFS 2012 build copy console application to _PublishedWebsites - visual-studio-2012

I am using TFS 2012 build option to build my web application. I have couple of console application in the solution. I want the console application output to be copied to the bin folder. In visual studio, I am doing this by using the copy command in the Post build event command option. But this does not work in TFS builds. The generated exe is not copied to the _PublishedWebsites folder in the BuildAgent directory

Possibility duplicate to Problems with MSBuild OutputPath and OutDir in TFS2010 .
Also give a try wiht this NuGet package, you can install it which will do this.

With TFS 2012 build process template, you need to custom build process template to run the script after building, like the post-build scripts feature in TFS 2013 build process template.
You can refer to this article to custom build process template to achieve your requirement.

Related

Setup.exe build from azure pipelines prompts for .NET framework 4.7.2 on every run

We are trying to generate a click once application using azure devops pipelines.
During this, we publish the project to create a setup.exe. All the pre-requisites required are ticked, the project builds and publishes the setup.exe without any issues.
However, every time the setup.exe is run we see the prompt in Image 1.
Image 1
We have ensured the installURL is correct, and the .NET Framework 4.7.2 is on the build machine and install machine.
When we publish the project in visual studio, the setup.exe does not show this prompt.
Does anyone have any idea how to stop this prompt showing or what we could try next?
In your Visual Studio build task in your pipeline, make sure you have Visual Studio 2019 selected due to a bug in earlier versions of VS.
https://developercommunity.visualstudio.com/content/problem/743594/dotnetfx472-and-dotnetfx48-not-finding-information.html

Emptying IIS website before automatic web deployment from TFS 2012

I'm automatically publishing a web project after build from TFS 2012 by using a publishing profile (I have a build definition on TFS that has /p:DeployOnBuild,PublishProfile... etc. as additional MSBuild arguments). Everything works fine. However, since my web site creates some temporary local folders I'd like to clean up before the next automatic deployment. Is there a way to easily clean up? Maybe some additional MSBuild argument?
You should switch to using Release Management for Visual Studio 2013. I have had it Woking fore more than one customer with 2012. You can then create orchestration that is specifically designed for deployment rather than compilation.
Release Management with Visual Studio 2013

The directory containing the assemblies for the Visual Studio Test Runner is not valid

We have upgraded our TFS installation from 2012 to 2013. When running our builds they will fail with the following error if unit tests are enabled:
TF900547: The directory containing the assemblies for the Visual Studio Test Runner
is not valid ''
The build process template or build definitions has not been changed after the upgrade. The upgrade process did not change them. Where can I provide the path to the Visual Studio Test Runner and where is it located on disk?
I do not know if "Visual Studio Test Runner" is a new option for 2013 or if this setting was also used before, when we were using TFS 2012.
We use Visual Studio Professional 2012 on the build server.
To do the second choice in Oswald's answer:
Right click on your build definition and select "Edit Build Definition..."
Click on the "Process" group in the build definition.
Find the "Automated Tests" group under "Build Process Parameters" and click on the ellipsis.
A "Automated Tests" dialog box will appear, select the test under "Tests to run" that you want to edit.
Click on the "Edit", a "Add/Edit Test Run" dialog box will appear.
Change the test runner to "MSTest.exe test runner"
Note: I am using TFS2012
You have two choices:
Install Visual Studio 2013 or the Agents for Microsoft Visual Studio 2013 if you want to continue to use the Visual Studio Test Runner.
Switch to MS Test as the test runner and change the Tools Version in the Build-Workflow. This will allow you to continue using Visual Studio 2012 on the build server.
Note: Tank you SteveC to post the link to the agents only site
The solution for us was to install the Agents for Microsoft Visual Studio 2013, rather than Visual Studio 2013
As an alternative to installing Visual Studio on the build machine, you can simply copy the files from your local machine to the build machine.
ZIP the TestWindow folder found in
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft
then copy it to the build machine, and unzip to the same location.
We had the same problem as the OP but, because the TFS server is considered a production box (other departments use it for other things), we were not permitted to install VS2013 on the server. The same applied to any third party tools needed for builds, they were a pain to integrate into the build.
I eventually worked round this by using another dev box to act as a build server for TFS. By installing the Build Server component of TFS on the dev box and setting up a controller and build agents on that box, TFS could pass the responsibility for the actual build to the dev box, on which we could install anything, without compromising the TFS server itself.
While it is not perfect - an extra box and VS2013 license needed - it is by far the easiest way to avoid poluting a production TFS box. Alternatively, nominate a developer's own box and install the build agent there - the environment is ready built, it will simply slow down a little during a build.
If your project does not have unit tests, you can just disable the unit test execution on the build definition.
To do that, edit the build definition, under process tab, delete everything in field "Automated Tests"

Invoke a publish from msbuild for visual studio 2012

For VS2010 and before I was utilizing Web Deployment Projects (WDP) to help package my website for production deployment. I had a MSBuild script that compiled the solution in release mode. An output of that was production ready website files compiled and cleaned by the WDP.
I see for 2012 WDP have been removed, and a new tab has been created in the properties for the web application. The options are the same, but now the invocation of this is done via the Publish option (before you just compiled in release mode).
So the question is this. From an MSBuild script, how do I invoke a Publish operation? I found some old posts that...
msbuild /target:publish
would do the trick. But that doesn't seem to work in 2012.
Also, I tried in my msbuild task...
<MSBuild Properties="Configuration=Publish;"
StopOnFirstFailure="true"
Projects="$(BuildDirectory)\MySolution.sln"></MSBuild>
...but msbuild just reported "unknown configuration".
How can I have msbuild run the publish option from the command line?
It appears that there are now some other options for publishing from the command-line. Specifically something along the lines of the following seems possible now with some RC updates to Visual Studio 2012.
msbuild mywap.csproj /p:DeployOnBuild=true;PublishProfile=MyProfileName
For more details check out this post by Scott Hanselman and check out the section on Publishing.
I wasn't able to get the publish to run, but looking at the output from Visual Studio I think I have found an alternate solution. Turns out the obj\Release\AspnetCompileMerge folder has a deployable and clean version of the project. It contains byte identical files to the final output folder.
I did have to change my msbuild script to include the DeployOnBuild option...
<MSBuild Properties="Configuration=Release;DeployOnBuild=True;"
StopOnFirstFailure="true"
Projects="$(BuildDirectory)\BigWave.ALL.sln"></MSBuild>

Building wsp from post-build event command line

What is the command for building WSP from post-build event command line?
I'm adding one more image so that you can understand my exact requirement.
You can build a WSP by using MSBuild. Each SharePoint project is build with the parameter
IsPackaging=True
By adding this parameter to the msbuild command you can ensure that all WSPs will be created.
You will have to depend on external tools like makecab.exe or WSPBuilder.
http://www.developerfusion.com/community/blog-entry/8390127/tfs-teambuild-and-sharepoint-wsp-deployment-and-any-post-build-events-for-that-matter/
http://www.fftf.org/news/Jul07feed/SharePoint_Solution_Deployment_Handy_PostBuild_Events.rss.html
I found the answer from here and it works for both SharePoint 2007 and 2010.
call "C:\Program Files\WSPTools\WSPBuilderExtensions\WSPBuilder.exe" -ProjectPath $(SolutionDir) -OutputPath $(SolutionDir) -SolutionPath $(SolutionDir)
This seems to be VS2010.
If you choose the project template to be a SharePoint 2010 project then you will find items in the context menu that are related to SharePoint. If you choose deploy, it will create the wsp package automatically and deploy it to the server.
To force Visual Studio to create a wsp on post build for SharePoint solutions, add these properties to the project xml. If you already have a post build event defined, just add the two inner tags to the existing property group. Visual Studio will create the wsp in the configured location; Release or Debug.
To edit the project xml unload the project in visual studio then right-click on the project and select edit.
<PropertyGroup>
<IsDebugging>False</IsDebugging>
<PostBuildEventDependsOn>$(PostBuildEventDependsOn);CreatePackage</PostBuildEventDependsOn>
</PropertyGroup>

Resources