源文件与构建模块时不同 [英] the source file is different from when the module was built

查看:20
本文介绍了源文件与构建模块时不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这让我发疯.

我有一个相当大的项目要修改.我之前注意到当我输入 DbCommand 时,visual studio 没有对它做任何语法高亮显示,我使用的是 System.Data.Common.

I have a rather large project that I am trying to modify. I noticed earlier that when I typed DbCommand, visual studio did not do any syntax highlighting on it, and I am using using System.Data.Common.

即使没有突出显示,该项目似乎在我的浏览器中运行良好.所以我决定运行调试器,看看事情是否真的像它们应该的那样工作.

Even though nothing was highlighted, the project seemed to be running fine in my browser. So I decided to run the debugger to see if things were really working as they should be.

每次调用没有突出显示的类时,我都会收到 源文件与构建模块时不同" 消息.

Every time the class that didn't do the highlighting is called I get the "the source file is different from when the module was built" message.

我清理了解决方案并重建了几次,删除了 tmp 文件,按照这里的所有说明进行操作 获取源文件与构建模块时不同.",重新启动 Web 服务器,但它仍然告诉我源文件不同当他们显然不是.

I cleaned the solution and rebuilt it several times, deleted tmp files, followed all the directions here Getting "The source file is different from when the module was built.", restarted the web server and still it tells me the source files are different when they clearly are not.

因此,我无法测试我今天编写的任何代码.

I cannot test any of the code I have written today because of this.

  • 我刚编译的时候,源怎么和二进制不同它?
  • 有什么办法可以让视觉工作室产生一些感觉,或者我我只是错过了什么?

推荐答案

我在运行控制台应用程序时遇到了这个问题,其中不同的源是具有入口点的源 (static void Main).删除 bin 和 obj 目录并进行完全重建似乎可以更正此问题,但是每次我更改代码时,它都会再次过时.

I got this issue running a console app where the source that was different was the source that had the entry-point (static void Main). Deleting the bin and obj directories and doing a full rebuild seemed to correct this, but every time I made a code change, it would go out-of-date again.

我发现的原因是:

  1. 我已选中仅在 Run 上构建启动项目和依赖项"(工具 -> 选项 -> 项目和解决方案 -> 构建和运行)
  2. 在配置管理器中,我的启动项目没有选中构建"

(对于 #2 -> 可通过调试/发布"下拉列表下的工具栏访问.)

(For #2 -> accessible via the toolbar under the 'Debug/Release' drop down list.)

这篇关于源文件与构建模块时不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆