开发者

Cross referencing over 2 projects doesn't compile

I'll keep it simple.

I have an ASP MVC project. It has all the logic and classes in it. Works fine.

I now want to make a console project to do a bit of housekeeping. I add this as a new proj开发者_如何学Goect within the same solution, add a reference to the MVC project dll so I have access to the same logic without having to repeat it. So far so good...

Finally I go to compile the console app and suddenly get 'the type or namespace xyz could not be found' errors, and simultaneously lose all the code color-formatting. It's as if I've removed the reference, but it's definitely still there.


Check the project target. When you create a console project, it defaults to .NET 4.0 Framework Client Profile which is a subset of the full .NET 4.0 framework. Client Profile does not support web projects, so references to the System.Web assembly (and also the Mvc assemblies) won't work. You can change this by changing the project target by selecting the Project Properties page and selecting the non Client Profile target.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜