Thursday, May 4, 2017

Building VS projects via command line

An important thing to keep in mind when running msbuild providing properties (in the form of /p:[Key]=[Value]) (for instance, a list of properties useful in building clickonce applications can be found here) is (taken from MSDN):
Global properties are properties that are set by using the /property switch on the command line, or properties that are set by the integrated development environment (IDE) before a project is built. These global properties are applied to all projects that are built by using this Engine.
In other words, if you build a solution with 7 projects (1 start-up plus and 6, say, class libraries), and you provide the AssemblyName parameter like /p:AssemblyName=MyAssembly, you will end up with 7 assemblies with the same name, one with an EXE extension (depending on your project template) and the others with DLL. I, for instance, wanted to rename the final EXE file. Doing this using the approach above did not work for me because of the DLL name conflicts. My scenario uses Jenkins as the CI tool, and I ended up adding a Windows Batch command at the end of the process that renames the $PROJECT_NAME exe only.

No comments:

Post a Comment