控制台应用程序不断失去与类库的连接
我已经使用现有的控制台应用程序和全新的控制台应用程序尝试过此操作。我将类库项目包含在控制台应用程序中。它工作正常,直到我构建它,然后我收到一个错误,询问我是否缺少参考。这是我的第一个控制台应用程序,关于控制台应用程序和类库有什么我不知道的吗?
I have tried this with an existing console application and a brand new console application. I include the class library project in the console application. It works fine until I build it, then I get an error asking if I'm missing a reference. This is my first console application, is there something I don't know about console applications and class libraries?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将控制台应用程序设置为启动项目,以便当您按 F5 时,您的控制台应用程序将被执行。
Set the console application to Startup Project so when you hit the F5, your console application will be executed.
我有完全相同的问题。当我尝试构建控制台应用程序时,构建失败,因为它不再具有引用;所以引用中的所有类都是未知的。
为了解决该问题,我将项目更改为目标“.NET Framework 4”而不是“.NET Framework 4 Client Profile”。
I had exactly the same problem. At the point when I try to build the console app the build fails because it no longer has the reference; so all classes inside the reference are unknown to it.
To fix the problem, I changed the project to target ".NET Framework 4" rather than ".NET Framework 4 Client Profile".
您是否尝试过将类库命名空间添加到控制台应用程序?
这对我有用!
Have you tried adding class library namespace to console application?
It worked for me!