user2441297
user2441297

Reputation: 249

Forbid particular class compilation

Lets say I have 4 classes in my App_Code folder (A B C D) and I want to compile 3 of them (A B C), and leave D in .cs file. But C is referencing to D so I can't exclude D from App_Code folder.

How can I forbid particular class from compilation?

Upvotes: 1

Views: 77

Answers (1)

Scott Chamberlain
Scott Chamberlain

Reputation: 127583

The trick to solve this is instead of having classes A, B, C, and D all in your Web app you split it in to two projects. One DLL where you have classes A, B, and C, and interface ID and one Web App with the class D and has the DLL project as a referenced assembly.

You just change your references in C to the class D to the interface ID and compile the assembly. In your Web App and have D in it implement the ID interface defined in the referenced assembly.

Doing that will let you have the D class still be modifiable while having A, B, and C all be compiled.

Upvotes: 1

Related Questions