You can use the App_Code directory in a WAP, but it’s not necessary and it’s very tricky. This is why you can move the files around and the behavior persists. If you create the file elsewhere, its Build Action is set to Compile.Ĭlick on the files and check the property grid to see the Build Action. When you add a file to the App_Code directory, its Build Action is set to Content (meaning “don’t compile”) because the ASP.NET compiler will be compiling it on the web server. YouĬreate a WSP via New Web Site, and it uses the ASP.NET complier to dynamically build the App_Code directory. Here’s what’s happening: you’ve created an App_Code directory in a WAP (Web Application Project) rather than in a WSP (Web Site Project.) You create a WAP via New Project, and it uses MSBuild to create an assembly for the web application. I also tried to manually add the App_Code subdirs to the and tags of the Web.config file, but anything changed with this behaviour. The root node of the project it works and keeps workng even moving inside any subdir within the project. ecc." not in the App_Code (or sub) directory but rather in the root node with the name of the entire project, and then I can move it in the destination App_Code subdirectory, and it keeps working.Īs a matter of facts it seems that is not important where the file IS but rather where I CREATED it: if I created a class from inside the App_Code it does not see anything and it is not seen by any other class, otherwise if I create it right clicking on Is create it right clicking on "add new element. The only way I found to correctly insert a new class file The smartTab do not see any custom namespace previously created in other classes, nor from other classes I can find the namespace and the class name defined within the new class file just inserted. If I insert a new class file, right clicking on "add new element -> class -> ecc." directly inside the App_Code directory (or in its any subdirectory) the compiler and I have the following problem programming in asp.
0 Comments
Leave a Reply. |