Oleh Khitrin
Oleh Khitrin

Reputation: 33

How to create composite .cs file

I need to create one .cs file from all .cs files of the solution(Visual Studio 2012) for some bureaucracy. Is there a plugin that can help me with it?

Upvotes: 0

Views: 156

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1502116

That isn't possible, in a general sense. Consider these two files:

Foo.cs:

#define X

#if Y
#error Bang!
#endif

#if !X
#error Bang!
#endif

class Foo {}

Bar.cs:

#define Y

#if X
#error Bang!
#endif

#if !Y
#error Bang!
#endif

class Bar {}

Note that #define and #undef have to come at the start of a C# file... so the whole file is processed with the same set of symbols defined - but your original two files were processed with different sets of symbols defined.

I would strongly advise you to try to remove the requirement.

Upvotes: 7

Related Questions