Post Build Event to fire Build of another project - visual-studio-2012

A quick Google search shows all sorts of options for pre & post build events but none seem to cover building multiple projects.
In my solution I have over 100 different projects (literally not an exaggeration) but at any one time I am only working one or two.
Often the two, three etc. being worked on have some connection and so changes to one means all three need to be rebuilt.
Rebuild ALL works but it takes minutes not seconds for all 100+ project to rebuild. Rebuild of just the one only works for the one.
Is there a way in pre build or post build to specify building another project(s).
The thought is when working for a week on say two projects I would specify in post build to also build project X.
Thanks

Open Project - Project Dependecies dialog in Visual Studio and fill dependencies for every project. This should give you desired effect, istead of using Post Build event.

Related

Unable to check into TFS and Build with Continuous Integration '

I have an Azure Web application that I checked into TFS yesterday with no issues. Upon checking in, the resource manager will inject our nuget packages and deploy if it builds successfully.
I made a few changes (added a class) and checked in today. I received this error on the build:
Here's the quote to help the future search bots:
Exit code 1 returned from process: file name 'tf', arguments 'vc unshelve Gated_xxxxxx;****** /loginType:OAuth /login:.,******** /noprompt'.
I looked into the log response, to see if I get more detail, but it says the exact same thing. I have not changed my password or username.
How can I debug this to figure out the issue?
UPDATE
To save others from the headache. The issue was that we had CI builds per project. A file from another project had snuck in as well. So I was checking in for 2 different projects on 2 different solutions (Which both go to the same TFS server). So make sure you only check in for that one project!
To save others from the headache. The issue was that we had CI builds per project. A file from another project had snuck in as well. So I was checking in for 2 different projects on 2 different solutions (Which both go to the same TFS server). So make sure you only check in for that one project!
You can receive that error as well if you try to check in a file that is in a project that is not mapped in your build definition.
Let's say that you have a file named FileA.cs that is in a project named ProjectA.csproj. If you do changes in FileA.cs and this file is included in your changes, you need to map ProjectA.csproj in the Get source step of the build definition.

Separate TFS Build excluding a single project

I have a solution that currently builds nicely in TFS. I have just added a Sandcastle help File Builder project to it so that the help files can be generated. Now the solutions takes ages to build locally (it has also doubled the build time on the TFS Server).
In practice I'd be happy generating the help files once per day, or only when specifically requested as part of a build.
I tried creating a separate solution (for a new build) which included the Sandcastle project but I got a warning saying that the projects were already under source control.
What is the best way to configure TFS/the solution for this sort of situation? Can I have two builds that run on separate schedules and include/exclude certain projects in the solution?
You can create a new solution configuration that excludes building your help project. Then in your TFS build you can specify which configuration to build. You could have a CI build that doesn't include your help project, and then a nightly build that includes everything.

Prevent Code Analysis from rebuilding project and dependencies in Visual Studio 2012

After upgrading our solution to Visual Studio 2012 we are looking to take advantage of the new Code Analysis feature. However, it is taking too long to run, because it is rebuilding the project and dependant projects before it runs, even though the code has not changed and does not need a rebuild.
Is there a way to stop it rebuilding code if a rebuild is not required?
I believe Johns statement above to be incorrect.
In my experience, the projects always get rebuilt regardless of whether they are configured for code analysis or not.
I have a solution with over 100 projects. if I select 1 project and run code analysis on that project only, it rebuilds that project and all projects it is dependant on. It doesn't run code analysis on the other projects, but it still rebuilds them.
So why does it have to rebuild all the child projects to run code analysis?
If you are just starting to use code analysis, then you may be mistaking the symptoms. You are seeing:
e
1. Code analysis takes a substantial amount of time, and
2. During code analysis, the project builds
You may be combining these two symptoms and reaching the conclusion that code analysis is forcing a rebuild of your project. This would be a false assumption. Try this:
Ensure that your projects are configured to not run code analysis upon build
Rebuild your solution. Note how long it takes
Build (don't rebuild) your solution, but this time, note how long it takes
You will find that your solution actually "builds", but since the projects are up to date, the compilers and other tools do not run.
So, it's true that code analysis runs a build of your solution first, but it will be a build like #3 above - nothing has changed, so the tools won't run. Only the code analysis tool (FxCop) will run. This takes longer than you might expect, but it's worth it.
In our environment, I created a "Local" solution and project configuration, copied from "Debug". This configuration is mostly the same as "Debug", but does not run code analysis. This is what our developers use on a day to day basis. When code is checked into TFS, it starts a Continuous Integration (CI) build in the "Local" configuration, again, without code analysis.
On the other hand, the nightly build runs the "Debug" configuration, so it does run code analysis. I find that we don't need the results of a code analysis on every build, but it's damned well necessary once a day.
OBTW, Code Analysis is not new. If you look at that MSDN page you linked to, you'll find a 2010 version of the page in the "Other versions" dropdown. In fact, the code analysis feature was available as a Visual Studio add-in called "FxCop", before it became part of the product.

CruiseControl.net checking files in source control (into different projects) after building them

I have set up an automated build server - so far so good. Now I want to sort out dependencies. We have several DLL files that are included in many (unrelated) projects, and I want to set up CruiseControl.NET to first build our DLL files and then "check them in" other projects in SVN, so when they get built, they will always use the last version of DLL files.
Is something like that even possible? Is there a better way to keep dependencies sorted over several projects on many computers?
The way I do this is to have a project in cruise control for the common dll, it uses a source control trigger and builds whenever changes are checked in.
On the dependant project, I have the source control trigger, but also a project trigger so any checkin on the common.dll causes the common.dll to be rebuilt, which in turn triggers a build of the dependant project.

Does CC.NET detect modification when a build script performs a checkin

I've been doing some research into finally automating our Development builds and still have one nagging question that I'm hoping the StackOverflow community can solve for me.
My understanding is that an IntervalTrigger when setup properly will check VSS every X seconds for changes and if it finds a modified file, will run my tasks. One of my tasks would be to checkout the AssemblyInfo files and update the version numbers. After these files are updated they would be checked back into VSS.
Thinking about this solution it doesn't make much sense because in my mind, I'm forcing the check for changed files to true every time the trigger fires. Am I missing something here? Is there a way of doing this without triggering an automatic build on the AssemblyInfo check-in?
You can use a Filtered Source Control Block to exclude certain files from the trigger.
I just posted a bunch about my default build process here which may be of some interest to you: SVN Website Development and Deployment Solution
The way I usually configure my projects with CC.NET is to have two project blocks per solution. One configured as an interval trigger that does nothing more than get the latest from my repository, build the solution, and run unit tests. The other is a schedule trigger that does all the things the other one does, but actually publishes a build. This includes changing version numbers, publishing files, etc. This might work in your case, since the change in version would cause the interval project to trigger, but only once.
Checking the automatically generated AssemblyInfo into the version control system is a bad idea, don't do it. You'll get a lot of noise (50% of all commits!) in your history. Also, it does not give you any new information - you can always pull this from VCS. Have your build script autogenerate those files is a good practice, but don't push those changes back!

Resources