Reputation: 183
Currently I am working on a ASP.NET project and Silverlight project, but I wan both of them to shares same helper class, database connector class etc. So I have all those helper classes inside a Class Library project DataServiceLibrary and include the project in both ASP.Net's Solution and Silverlight's Solution.
But since they have some difference between ASP.Net and Silverlight, so I got a lot of conditional compile statement in the DataServiceLibrary. Then I define the Conditional compilation symbols at the project Properties => Build => General => Conditional Compilation Symbols.
The problem is the Conditional Compilation Symbols will save into the project, so if I save the Conditional Compilation Symbols as ASP in ASP's solution. Then it will overwrite the one I wrote in Silverlight solution.
I wonder is there a way I can define the Conditional Compilation Symbols under whole solution?
Thanks in advance, King
Upvotes: 0
Views: 427
Reputation: 28338
Create a separate build configuration in your shared library project for each set of conditional constants. The use the Build Configuration Manager in your solutions to specify which build configuration to use.
For example, have:
DebugForAsp, ReleaseForAsp, DebugForSilverlight, ReleaseForSilverlight.
The Build Configuration Manager screen (right-click on a solution to see the menu option) will let you easily crease a new configuration in a given project and copy the settings from an existing one.
Upvotes: 1