0

I have 3 different VisualStudio solution, one is in C++, another one is in C# and the last one its VisuaBasic.

I want to share the AssemblyVersion property so that we can have a single point where to change the version number among the different solutions. My issue in creating a shared AssemblyInfo is that each solution has a different syntax for the AssemblyInfo

C#

[assembly: AssemblyVersion("X.Y.Z.W")]

VB

<Assembly: AssemblyVersion("X.Y.Z.W")>

CPP (optional, not fully required to be update together with C# and VB solutions)

[assembly:AssemblyVersionAttribute("7.6.2.2")];

Is it possibile to use some mechanism like a preprocessor macro? We just want to update the version number in a single file

Thanks

MarkL
  • 1,721
  • 1
  • 11
  • 22
edenroz
  • 13
  • 6
  • 1
    The most re-usable way of doing it might be to do something with a WriteCodeFragment task in project files (which I think could be put into a common included file). I'm pretty sure this would have to be written manually, I don't think there would be any direct IDE support. Another alternative would be to have e.g. a batch file to generate C#/VB/C++ assembly info files. Note that the assembly info can be split across multiple files. – Craig Oct 27 '22 at 14:03
  • I don't want to add another .bat to our messy toolchain. I'll look into WriteCodeFragment but it does not seems an easy task – edenroz Oct 27 '22 at 15:09
  • I think it's pretty straightforward. There are several questions on WriteCodeFragment; the first one I found that looks helpful is https://stackoverflow.com/questions/4300346/using-writecodefragment-msbuild-task – Craig Oct 27 '22 at 15:27
  • Could also look at the Build events on your projects, wire them up to get the value for assembly versions from some predefined source – Hursey Oct 27 '22 at 19:36

0 Answers0