Check for missing files in Visual Studio solution
I've a visual studio 2013 solution with several c# projects.
There are some class library projects as well as an asp.net mvc project.
The asp.net mvc project contains in addition to c# files also lots of html/javascript/css/images.
If i now commit this project, and forget to add a c# file in source control, the build will fail, and teamcity will show this to me.
But if i forget to add an image to source control, the build on teamcity will succeed even if this file is missing.
Is there a way to force teamcity to fail the build in this case?
Please sign in to leave a comment.
TeamCity uses MSBuild to build VisualStudio solutions. If MSBuild fails - build on TeamCity fails. So, for the files that are consumed by compiler it comes oout-of-the box.
For resource files there is no way of providing such detection, as they are neither consumed, nor inspected by compiler and MSBuild
This is what i was afraid of.
I now did create a unit test for this. It scans all project files, and check that all files are where they must be.
It's a a hack, but it's ok for me.
If one of our devs forget to add and commit a file in sourcontrol which was previously added in visual studio, this unittest will fail.
That's a nice solution!
What you can do more is to try to report custom build status from the test itself, so that you can see that some files are missing directly from overview page
Hi Manuel,
I'm not familiar with asp.net mvc, but for one of our .csproj files I made a modification described here. This makes MSBuild fail if it cannot find one or more of the Content entries, so, consequently, TC will fail the build. In our case, the content was .sql files. Perhaps you can use a similar approach in your projects for other file types.
Regards,
Oleg.