0

I am in the process of refactoring and tidying up an assembly that I have built. Previously I had built this using two completely separate solutions, one targeted towards the .net2 framework the other towards the .net4 framework. With the exception of one very small section of code that needs to be framework specific the code is identical in both solutions.

So as well as refactoring I felt that it would also make sense to have both 'versions' of the assembly in the same solution and have all of the common code in a solution folder making for easier maintenance , with this code being linked to the respective projects targeting each framework.

I have now got to the one section that requires slightly different code for the respective frameworks and I know from looking at various bits of information that this would probably best be done with an #If statement.

What none of the various posts that I have read talk about is whether there are any hard and fast rules about what follows the #If. I tried adding one of the project names but that caused an error in the compiler along the lines of 'End of Statement Required' I could however put DOTNET2 there and it appears to be perfectly acceptable. Is that the correct way to differentiate between the projects that are targeting the two .net frameworks?

Dom Sinclair
  • 2,458
  • 1
  • 30
  • 47

0 Answers0