Cannot compile solution?
I have business layer in my solution. I added console project to the solution. Added necessary reference to console application. Created instances of classes in business layer. I'm using resharper so code 开发者_运维问答looks correct.
when I try to build I get the error like
Error 127 The type or namespace name 'BusinessLayer' could not be found (are you missing a using directive or an assembly reference?) C:\ConsoleApplication\Program.cs 13 25
if I reference business layer from web project under the same solution it compiles, but with console it's not.
do you have any idea what can be the problem?
Add using BusinessLayer;
in the top of your application, if you already did that, then try to clean and rebuild the solution.
Also make sure that both the library and the console application have the same .net framework version, for example both are 4.0 and not one of them 4.0 client profile...
You seem to confuse a library (project) reference and a using
statement judging by your comment:
I have the reference at the top of the page.
You need both to add a reference (right-click your project's References folder in Solution Explorer > Add Reference...) and add a using
directive at the top of the code file to import the required namespaces.
You'll have to add a reference to that assembly from your console project.
You add references at the project level not the solution level, so the reference you added to your web application doesn't help your console app.
Right click over your solution, configuration manager, you will see all projects, be sure that you have marked all necessary projects to build with right platform.
Hope it helps.
Rebuild the BusinessLayer class library and build your solution again.
精彩评论