A recent thread reminded me that I wanted to take a closer look into Visual Studio, specifically the building process.
I noticed something right away that I thought I'd offer up as a quick tutorial/discussion.
Using
this as the basis of our discussion, I thought I'd help streamline the process of creating the manifest. The tutorial calls for you to manually create a text file but doing anything manual is boring and subject to failure (I avoid manual--and automate as much as I can with my build process--because I tend to screw up a lot). Instead of creating the text file in the directory specified (C:\ProgramData\Autodesk\Revit\Addins\2015\) I added a "new item" to Visual Studio in the Solution Explorer (a text file). This just creates the file in my projects directory and allows me to edit in right from VS. I then I went to my project properties and added a post-build event. Something like:
xcopy $(ProjectDir)\HelloWorld.addin C:\ProgramData\Autodesk\Revit\Addins\2015\HelloWorld.addin
but I'd still be doing some manual editing of the manifest file. *BLEH!* Right away I can see how being limited to native Windowd CMD line tools we will limit our options severely, so here is a little trick you can use in your projects with very little effort on your part.
1. Go grab my LiFP tool and install it (LiFP is just a simple pre-processor which works on any text file).
2. In your manifest: change the "Assembly value" to something like: "<Assembly>[PROJDIR]HelloWorld.dll</Assembly>"
3. In your projects post-build we can use LiFP to automatically change this value for us with the following post-build command:
LiFP.exe -d [PROJDIR],$(ProjectDir) -i $(ProjectDir)\HelloWorld.addin -o C:\ProgramData\Autodesk\Revit\Addins\2015\HelloWorld.addin
What this does is use LiFP to swap the text "[PROJDIR]" with the built in Visual Studio Macro "$(ProjectDir)" value when it creates the manifest file in the C:\ProgramData\... folder.
Nice huh?