TFS 2012 Build: sln or csproj? - visual-studio-2012

Just wondering if there is a preference between sln or csproj files when building projects in TFS 2012. We typically build sln files in TFS to support our dev teams and that's usually the standard, but one team is asking why we can't build csproj files instead in TFS.
I noticed that to build a csproj file you have to provide arguments in the MSBuild Arguments field for a TFS build definition, and you do not have to provide these arguments when building a solution file. So other than this small detail I'm not sure what the pros and cons are between building an sln vs csproj.
Can someone please shed some light on the benefits, pros/cons of building a sln vs csproj in TFS, is there a common practice, a standard, or does it really matter?

Just wondering if there is a preference between sln or csproj files
when building projects in TFS 2012. We typically build sln files in
TFS to support our dev teams and that's usually the standard, but one
team is asking why we can't build csproj files instead in TFS.
Why do they want to do this? Is there some sort of advantage articulated in this inquiry?
I noticed that to build a csproj file you have to provide arguments in
the MSBuild Arguments field for a TFS build definition, and you do not
have to provide these arguments when building a solution file. So
other than this small detail I'm not sure what the pros and cons are
between building an sln vs csproj.
A .sln is a master project that is converted to an msbuild script at runtime and will use a metadata file using the same schema as the .csproj projects in your solution.
To see what I'm talking about, open a command prompt, type "SET MSBUILDEMITSOLUTION=1" then "msbuild.exe solution.sln", then parse the new "solution.metaproj" and "solution.metaproj.tmp" files.
Can someone please shed some light on the benefits, pros/cons of
building a sln vs csproj in TFS, is there a common practice, a
standard, or does it really matter?
A .csproj would be a single project while a .sln would be a collection of projects. Building a single .csproj would yield the output binaries of that project (along with dependencies) and building the entire solution would yield the outputs of the entire solution.

I had the same question. Build times may be a bit slower but I haven't tested this myself (probably a negliable difference). I believe that when you build using the solution file it will automatically set 'BuildInParallel' to true.
Faster Buidls with MSBuild

I am currently working on the TFS 2012 deployment build. Based on what I experience, you don't have to provide MSBuild Arguments unless it is really required.
Lets take the following example: You have a solution with 2 projects,
Soln
> Web Proj 1
> Console Proj 2
> Dependency Library Folder
case 1: building a sln
a. In source settings, you have to mention only your solution folder. The MSBuild will automatically take care of any dependencies as they are within the solution.
b. In Process -> Items to build, you have to mention your solution file.
c. For example, if your solution has a web project, then the MSBuild output will be as shown below,
\\<build server> \d$\Builds\<Build Name>\<Build File Name>_20141210.6\_PublishedWebsites\<web proj>
Case 2: building a csproj
a. In source settings, you have to mention only your csproject folder and also the dependency folder path separately.
b. In Process -> Items to build, you have to mention your csproject file.
If you are looking for something more specific, please let us know.

Related

Not able to execute selenium test cases via Azure Devops release pipeline

I am trying to configure and run selenium test cases from Azure Devops Release pipeline. I did configure Visual studio Test Platform installer followed by Visual studio test. However, while running the 'test task', its erroring out stating
2019-12-22T11:31:50.7602521Z ##[warning]No test sources found matching the given filter '**\*csproj'
Am I missing something here or not doing proper configuration?
My main test case is being written in .cs file and tried including it in path as well but still same error.
Can someone please guide me?
thanks,
Pankaj
You have to add the path to the assemblies - dll. cs files are not used here as they are not compiled.
Provide the search pattern in the Test files field
Example search pattern:
**\publish\Test.Project.Name.dll
!**\*TestAdapter.dll
!**\obj\**
Have you built your project? Since you said you can see only files which are .cs or .csproj. You should first build your project to generate .dll files which are used in your vstest test files.
You can add the Visual Studio Build Task above the Visual Studio Test Task, then choose your project(.csproj or .sln) in the Solution Tag.
After building, you will see the .dll files in your Artifact, then, as Jonah said, you need to specify the location of the .dll file in Test files.

Running an MSBuild project from TFS

I am have built an MSBuild project that has
the main .proj file with several Targets inside,
several .targets files
and several .rsp response files to run this project in several ways. Such as
Build, Clean/Build/Deploy, Clean/Build/Test/Deploy.. You get the idea.
What I now want to do is take this MSBuild and run it in TFS scheduler after I pull the source code. So the workflow should be
1. Pull the source code in TFS
2. Run MSBuild project in the scheduler so I might set up tasks to run hourly and nightly.
The MSBuild will take care of Deploying to IIS, unless someone has a more efficient way of deploying after an hourly build.
How can I accomplish this in TFS?
Thank you
You can use the Team Explorer UI in Visual Studio to define a "scheduled" build definition.
http://visualstudiomagazine.com/articles/2012/04/11/creating-a-build-definition-in-tfs.aspx
If you want to take this to the next level, research "continuous integration" which is also a built in capability.

How to build .exe of a solution

I recently finished a solution composed by 2 project. For this 2 project I have the .exe build, but I don't know how to do the exe of solution with VS 2012. Someone know how to do it?
When you compile & build a solution, the .exe that is created is placed into the folder relating to your current build configuration, usually either Debug or Release.
So navigate to the folder, on disk, using Windows Explorer, where the solution is stored, and look in the Debug folder. The compiled program is there.
If this is not what you are after, please post more details about these two projects and how they 'tie together'.

MSBuild cannot find reference when executed through TFS build service

I have a solution with reference to Telerik assemblies. The referenced version has been installed on the build server. The issue is that the continuous integration build always succeeded until I upgraded the Telerik assemblies in the solution and on my build server. The build now fails giving the classical:
Could not resolve this reference.
I checked my solution and everything is set to reference the specific version. The most suprising is that if I open the solution locally on the build server, everything will build without a problem... so that means the Telerik assemblies have been published somehow, but for an unknown reason, when MSBuild is called to compile the solution throught the build service, it does not work.
Any ideas?
I had the same problem after updating to the Q3 release.
To solve this, I built the solution with Logging Verbosity set to Diagnostic, and found that MSBuild never bothered to look in the Telerik folder.
So to include that folder in the build, we simply added it by adding a MSBuild argument:
/p:ReferencePath="C:\Program Files\Telerik\RadControls for WPF Q3 2012\Binaries\WPF40"
It's perhaps not the best, and needs to be updated everytime you update RadControls, but it works.
We run the build server on a x86 installation, so Telerik is located under C:\Program Files, but if you run on a x64, it's under C:\Program Files(x86), so if you run several build servers on both x64 and x86 installations, you must specify both path.
Try to remove-then-add reference to updated dlls - you can then see in proj file if there any differences with referenced assembly.
Enable verbose\diag mode for msbuild (/v:diag command line key) and check build logs. Diag mode have very detailed output about referenced library search process.
I normally find it's better to copy the referenced assemblies into the solution and reference them from there. Then the build server and other developers don't need to worry about installing that specific version and you can support multiple projects running different versions of the component.

Using Ivy/Maven for C++ binary dependancy management in Visual C++ environment

I am looking to provide a better way of managing the distribution and storage of binary dependencies for a large VC++ project.
Currently we have the situation where externally and internal built libraries are stored within the the source control repository resulting in the .cpp and .h files forming less than 3% of the space that is retrieved. This makes the process of creating a branch slow, and prevents sensible migration to a DVCS.
I don't want to change the main method of building through MS visual studio solutions, but I am willing to add an additional step to fetch/setup all the binary dependencies.
This is currently achieved for some libraries using are existing Source Control, by mounting different repositories containing the built files. This could be one approach (which I don't favour).
Has anybody got experience of using Ivy or Maven in a VC++ environment?
The maven-nar-plugin might be solution for you.
Maybe vcpkg is a alternative solution for you.
Documentation is available here or for Visual Studio here

Resources