'Why are my Preprocessor Directives locked
I've done lots of research but haven't found any answers yet.
I'm working on a plugin to run inside a proprietary program called Autodesk Revit. This plugin needs to be distributed to 3x different companies, each using the their own filing system.
I'm storing some file paths in read-only fields in a separate static class in another project in VS but within the same solution and used preprocessing directives to define symbols named after each company I'm distributing the plugin to. I then set each field to different file paths under preprocessing #if, #elif, etc, so I can just define/undefine the symbols before compiling the code so I can distribute them to each appropriate company (sample code below).
I have no conditional compilation symbols setup in the property of either project and I realise I can use config files for that as well but since this plugin is running inside a host program there are some workarounds needed to get that to work which I'd rather avoid.
Regardless of what symbol I define or undefine, my plugin is pointing at COMPANYB at all times. What am I missing?
#define COMPANYA
#undef COMPANYB
#undef COMPANYC
namespace MyNamespace
{
public static class FileLocations
{
#if COMPANYA
public static string fieldA => @"\\serverNameA\filenameA.rte";
public static string fieldB => @"\\serverNameA\filenameB.rte";
public static string UsageFolder => @"\\serverNameA\ScriptUsage\";
#elif COMPANYB
public static string fieldA => @"\\serverNameB\filenameA.rte";
public static string fieldB => @"\\serverNameB\filenameB.rte";
public static string UsageFolder => @"C:\Temp\";
#elif COMPANYC
public static string fieldA => @"\\serverNameC\filenameA.rte";
public static string fieldB => @"\\serverNameC\filenameB.rte";
public static string UsageFolder => @"C:\Temp\";
#endif
}
}
Solution 1:[1]
I found the issue. My VS solution has two projects which are two plugins (plugin A and plugin B) which run inside the main program (Autodesk Revit). Both plugins share what I call "helper classes" which I created as a third project in the solution.
I updated one of the helper classes and rebuilt plugin A but plugin B had an old version of the helper class dll in the folder which seemed to be taking precedence over the new one. Once I replaced that dll as well plugin A worked as expected.
I'm fairly new to programming (approx 2 years) and self taught, every bit of advice is very welcome to help me avoid these issues in the future.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | floretti |
