Reputation: 147
I am trying to utilise the advantage of App_code folder in my project. I have gone through THIS POST I have added Empty web site and added webforms to it. I have 3 layers in my project. I want to use the class in app_code in my Data layers. But which i am not able to use...
I went on googling and what i find is " THIS ".
Again when i tried to change the Build action of that class in properties, i could not even find the properties of that class in solution explorer. Please anybody help me what i am missing here...?? Snapshot below
Upvotes: 0
Views: 1037
Reputation: 7537
At the bottom of the screenshot, you might see a "Properties" tab, or you might have a "Properties" window. You can also go to View -> Properties Window, or press F4. Any of those should bring it up. While you have "Helper.cs" selected, the properties should appear in that window - one of which is the Build Action property you mentioned, and you set that to "Compile".
There are several other things you need to do to make your class accessible to your project. You should add a common namespace for all of your code-behind and classes, and then add using MyNamespace;
statements at the top of these classes. You would need to ensure your classes and methods you are calling are public/exposed to the classes doing the calling. There are also issues where the App_Code folder seems to have issues, and just creating a generic folder called "AppCode" (no underscore) and putting the files in that seems to correct the problems (at least, that's how I had to solve some issues).
As for why "Properties" doesn't appear on that menu in your screenshot, you might need to re-install Visual Studio - seems like a bug, to me.
Upvotes: 1