Configure Teamcity to build a published website with Visual Studio - visual-studio

How does one configure the teamcity build process to produce the same compilation result as if I told Visual Studio to publish a website from Visual Studio?
basically, I need teamcity to build the website with a publishable package...then publish the package as an artifact, which I can then deploy on AWS using command line commands.
Is it possible? What are the command line MSBuild parameters necessary to get Visual Studio to spit out what I am looking for, and what would I need to match in the build output in order to publish the package? Currently, the website is too big for me to publish everything as an artifact, so I'm having trouble figuring out what to match for artifact publishing.

You need to build target WebPublish - that's what VS does when you select web project and publish it from context menu.

Related

How can I consistently automate, using TFS vNext build steps, building whatever solution files our development teams get working using Visual Studio?

Developers use the Visual Studio (VS) GUI to develop their solutions and get their projects all building using a solution file (.SLN). The build teams using vNext then have to automate those builds using MSBuild instead of devenv.exe (the Visual Studio executable file). This is a serious and chronic problem because not only is MSBuild incapable of building several project types, but the build order is defined in a completely different, and complex, way.
Some Microsoft advice (https://learn.microsoft.com/en-us/archive/blogs/msbuild/incorrect-solution-build-ordering-when-using-msbuild-exe) is to switch to explicit dependencies in each .*proj file and remove all dependency specifications in the .SLN file. This sounds like a person who has never worked in a relatively powerless build team trying to get development teams to:
do a lot of what they perceive as time-wasting extra work and to
change how they do things
What build teams need is a way to automate whatever VS allows dev teams to build. If VS is given a SLN to build, then a vNext build needs to be able to use that same SLN in the same way. Instead vNext currently only offers MSBuild as the build tool. MSBuild has many more options than devenv, so that would be great, IF it could be made to use the SLN to govern dependencies in the same way as VS, and would be upgraded to build all the same project types.
There have been prospective efforts, referenced by PatrickLu-MSFT at Build project using devenv.exe in TFS 15RC1 Build Server, to enhance a vNext build step to allow devenv to be used instead of MSBuild, but those efforts seem to have been dropped.
Maybe someone has developed a custom vNext build step to build using devenv?
Here is an existing extension you can reference, which provides a build task in your TFS/VSTS instance that will allow you to build your projects using DevEnv.com (Visual Studio):
https://marketplace.visualstudio.com/items?itemName=mmajcica.devenv-build
If you want to automatically use TFS/DevOps build whatever solution files our development teams get working using Visual Studio, you could set CI trigger in build pipeline, when the solution build successfully on local, you can check in/commit the changes, and trigger TFS/DevOps builds.

How does "Publish" in Visual Studio Work?

I am wondering how does Publish in Visual Studio work, the question is:
Does the Publish in VS gets the code in the control-version to be built and published or does it get the code in local-machine to be built and published?
How does Publish in Visual Studio Work?
In simple terms, Publishing creates the set of files that are needed to run your application, and you can deploy the files by copying them to a target machine.
See How Web Publishing In Visual Studio Works for some more details.
Now, we need to figure out the question "Does the Publish in VS gets the code in the control-version to be built and published or does it get the code in local-machine to be built and published?".
To figure out the question, we need to change the "MSBuild project build output verbosity" to "Detailed". Do this by Tools -> Options...->Projects and Solutions->Build and Run. Set the MSBuild project build output verbosity level to Detailed. Then publish our project and check the log on the Output window, you will find Visual Studio copy the files from obj folder instead of the source code in the project file when you publishing project:
So, Publish code should come from local-machine to be built and published.

How to get output in team build in TFS

I started learning TFS Team build. I am having a basic doubt. I referred this
article. I followed the steps exactly and got succeeded. I created a Console Application and pushed in TFS using TeamServices. My doubt is when we build a Console application in visual studio we will get an exe in bin folder.
Same way in this team build how to get the output in my local machine ?
What is the difference between the local build using Visual studio and this team build ?
EDIT :
I added like this. Still I am not able to see the output in the RELEASE folder.
I got the result as success saying
Still I couldn't figure out the output - the exe produced as a result of build.
Am I doing anything wrong ?
Note : I have a requirement like what you explained in the answer. So why I am using TFS team build. Since I am new I am experimenting with a small example.
When to use a build system
Team Build does not replace Visual Studio build. Use Team Build when you have a complex / lengthy build, to easily integrate running unit tests as part of the build or to deploy assemblies to a server after the build is complete.
Most people will setup a TFS build definition to run as "Continous Integration" build, meaning that whenever a commit is checked in, a build occurs. The build would compile and run tests and if it fails all developers can be notified.
How to get to the build output
When using a build system like TFS build, the build is done on a remote machine. If you want to retrieve the output of the build, add a Publish Build Artifacts step to your build definition. Since the build happened on a remote machine, the remote machine does not have access to your local developer machine.
The artifacts (assemblies) will be available for download on the build summary page:

How to publish my Outlook AddIn project with MsBuild

How can I publish my Outlook Addin project from my solution(I don't want to publish all my solution) from command line tools(MSBuild)?
Furthermore I'd like to use TeamCity to publish this OutlookAddin(just this project from solution).
THX.
I think you can find the information you need here;
How to build an Office Add-In without registering it on the build system?
TeamCity supports MSBuild configuration steps, so once you get the MsBuild setup correct, getting TeamCity to build your addin should be straightforward.

TFS 2012 deploying mutliple profiles after build

I am currently using a build definition for continuous integration in TFS 2012.
I am using the following build arguments
/p:DeployOnBuild=true;PublishProfile=DEV_SERVER;Password=secret
and everything works well.
Now I need to publish the build to more than one site, and I have created the publishing profiles in visual studio. But how to tell MSBuild to use more than one profile?
/p:DeployOnBuild=true;PublishProfile=DEV_SERVER1;Password=secret /p:DeployOnBuild=true;PublishProfile=DEV_SERVER2;Password=secret /p:DeployOnBuild=true;PublishProfile=DEV_SERVER3;Password=secret
does not work. Only one site is published. (I'm not sure the first or last)
Does anyone know how to specify?
I know that I can duplicate the build definition on TFS using another profile in this new build definition, but in this case the application will be built TWO times and the releases on the servers have different build numbers.
you can specify publish xml in the MSBuild arguments
/t:Build /t:Publish /p:SqlPublishProfilePath=DEV.publish.xml
also this option only works for TFS2012 and VS2012

Resources