I am working on asp.net(3.5)
in my project there is one layer named app_code contain the business logic of the project
in this project I have added one reference file named Microsoft.ApplicationBlocks.Data
when I include namespace in default.aspx.cs file it works properly but when I work on the business logic class file which is in app_code folder I show compile time error.
I have not find any solution
please give solution....
thanks in advance....
add reference to that dll in your files like using <dllname>
Related
I have 3-layer MVVM project, my solution folder, DLL folder and BLL folder are inside 'source > repos >' and project loads normally
But if I move BLL or DLL(or both) to some other folder, or Desktop for example, my project doesn't load correctly and file moved to Desktop defined as not founded in solution explorer
How could I fix it? I need put all this three project folders(DLL, BLL, View) to one folder, because I need to share it as one big project, but I can't, because any movement with files or folder finishes with error 'Files not founded'
Sadly can not send images here, in y question(
Thanks in advance for your answers!
Check for that in your project: is it in the references list? If it is, check that it's built for the same CPU type as your project, and that the Reference properties option "Copy Local" is set to true.
If it isn't, try adding it. If that works, try rebuilding. If it doesn't, then it's probably a Native Library, and you need to ensure that the DLL is either in the EXE folder, or in a folder on the current PATH that Windows uses to locate executables.
You Need to compile the DLL project into a dll file and then refer to the compiled dll file.
Or just use project references to add your DLL project and BLL project.
I’m working with a new ASP.Net project in Visual Studio 2019. I’ve imported two files that play nicely together in another project, but not in this one.
One file lives in the root folder and references a class that’s defined in another file, one that lives in a subfolder off of the root, App_Code. The problem is in the file off of the root – the reference to that other class has a red line under it. It says, “The name ‘blah-blah’ does not exist in the current context.” It’s not picking up the class defined in the App_Code folder.
Neither file has any namespace declared – they both just define their respective classes… Again, these two files play nicely in an older project, but not in this new one.
Any thoughts? Thanks for the help!
You might have space in folder name, that causes Visual Studio not to find the referenced file.
My web application project has an App_Code folder. I want to use the methods in these classes from my aspx.cs pages.
There are some classes in the App_Code folder I can access, and some I can't.
I can't spot any differences between them. For instance, all classes have the Build Action property set to Compile.
Is there anything else I should be doing to ensure I can call the classes in the App_Code folder?
With Web Application Projects, you shouldn't be adding App_Code folder. It is intended for Website Projects. With Web Application projects, all your class files are anyways compiled.
The same result can be achieved by creating any folder (MyCodeFiles) and having all the class files inside it. That is why there is no option to create an App_Code option in the VS menu.
If it works, can you try adding a custom folder and see if it has any issues?
If you still need the App_Code to be there, then try checking the namespaces of the files & the build action again.
i have a project say MyProject. It is an asp.net MVC project. In bin directory, i have deleted a DLL named MyProject.dll. Now when i try to build the project, i am getting following error.
The name MyProject does not exist in
the current context.
In my view files and controller, there are a lot of code like
MyProject.Models;
or
MyProject.Utility.IsValidEmail(email);
how to build this solution?
obviously, the MyProject.dll is the compiled code of the MyProject instance. WHy did you delete it?
So I wrote some custom classes and put them all in a namespace, call it "Sphere".
On my aspx.cs codebehind file, I have "using Sphere;" written. I know that this works because it's always worked until I copied this project to a new folder. Also, even when I click "view in web browser" everything works perfectly.
Simply, Visual Studio 08 is not recognizing the namespace and so I cannot build without an error and consequently cannot debug. Thanks for the help!
edit:
I have my namespace in my App_Code folder in a .cs file
Are your custom classes in a separate project? If so, you might need to add a reference to that project. If you have copied the project to a new folder, the path to your Sphere DLL/project in VS2008 might be broken.
I actually just figured it out:
My .cs files were set to "build action: content" rather than "compile." I right-clicked + properties all my files and changed the build action, and now it all works!
Sounds like missing reference.
In your new project, do you have a reference to the project that defines the actual Sphere namespace?
Check your references. It's possible VS is no longer finding them after you moved your application's folder.
It sounds like when you moved the files the references were broken. If the sphere classes are in a seperate dll try deleting and re-adding the reference. If it is just in a .de file be sure that filein the project is still in the relative path.
Probably you got this error:
The type or namespace name 'CustomClass' could not be found (are you missing a using directive or an assembly reference?)
And the reason the type was not in the assembly is that App_Code folder is specific folder for Web Site Projects. These files get compiled at runtime when they are deployed on server and not when you are building the project.
In Web Application Project every file has Build Action property. By default the classes files have value of Compile. But if the class is created in App_Code file it gets value Content. and does not get compiled when running as Application.
A the end the App_Code folder is not meant to be used in Web Application. Or as you figured it out you can manually change the Build Action to Compile.
I found the answer by searching these links:
Vishal Joshi's Tangent - App_Code folder doesn’t work with Web Application Projects (WAPs)
Build Action" property set to "Content" for class files inside App_Code folder