program tip

소스 파일이 모듈이 빌드되었을 때와 다릅니다.

radiobox 2020. 8. 22. 08:31
반응형

소스 파일이 모듈이 빌드되었을 때와 다릅니다.


이것은 나를 미치게 만든다.

수정하려고하는 다소 큰 프로젝트가 있습니다. 를 입력했을 때 DbCommandVisual Studio가 구문 강조 표시를하지 않았고 System.Data.Common.

아무 것도 강조 표시되지 않았지만 프로젝트가 내 브라우저에서 제대로 실행되는 것 같았습니다. 그래서 디버거를 실행하여 제대로 작동하는지 확인했습니다.

강조 표시를하지 않은 수업이 호출 될 때마다 나는 "the source file is different from when the module was built"메시지를받습니다.

솔루션을 정리하고 여러 번 다시 빌드하고 tmp 파일을 삭제 한 다음 여기의 모든 지침을 따랐습니다. "소스 파일이 모듈이 빌드되었을 때와 다릅니다." , 웹 서버를 다시 시작했지만 소스 파일이 명확하지 않은 경우 여전히 다릅니다.

이 때문에 오늘 작성한 코드를 테스트 할 수 없습니다.

  • 방금 컴파일했을 때 소스가 바이너리와 어떻게 다를 수 있습니까?
  • 비주얼 스튜디오에 감각을 두드리는 방법이 있습니까? 아니면 뭔가 빠졌습니까?

다른 소스가 진입 점이있는 소스 (static void Main) 인 콘솔 앱을 실행하는이 문제가 발생했습니다. bin 및 obj 디렉토리를 삭제하고 전체 재 빌드를 수행하면이 문제가 수정되는 것처럼 보였지만 코드를 변경할 때마다 다시 구식이됩니다.

내가 찾은 이유는 다음과 같습니다.

  1. "만 빌드 시작 프로젝트 및 실행에 대한 종속성"(도구-> 옵션-> 프로젝트 및 솔루션-> 빌드 및 실행)을 확인했습니다.
  2. 구성 관리자에서 내 시작 프로젝트에 "빌드"가 선택되지 않았습니다.

(# 2의 경우-> '디버그 / 릴리스'드롭 다운 목록 아래의 도구 모음을 통해 액세스 할 수 있습니다.)


나는 단지이 같은 문제를 겪고 있었고, 내 프로젝트는 모두 동일한 솔루션에 있었으므로 Project to Project 참조를 사용하고 있었으므로 하나가 변경되면 다른 하나가 업데이트되어야했습니다. 그러나 그것은 사실이 아니었고, VS2010을 빌드하고, 다시 빌드하고, 닫고, 소스 컨트롤에서 새 복사본을 가져 왔습니다. 이 중 어느 것도 효과가 없었고 마침내 시도한 것은 프로젝트를 마우스 오른쪽 버튼으로 클릭하고 각 프로젝트를 개별적으로 다시 빌드하는 것입니다. .dll 및 .pdb 파일을 업데이트하여 디버깅 할 수있었습니다.

여기서 문제는 dll 및 또는 pdb 파일이 동기화되지 않는다는 것입니다.


다음과 같이하세요

  1. DLL이 생성 된 프로젝트에서 bin 디렉토리를 삭제하면됩니다.
  2. 프로젝트를 다시 빌드하십시오.
  3. DLL을 참조하는 프로젝트에서 참조를 제거하십시오.
  4. 참조를 다시 포함하십시오.
  5. 즐겨.

이러한 답변 외에도 잘못된 경로로 인해 새 DLL을 이전 DLL로 교체하는 동안 동일한 문제가 발생했습니다. 이 오류가 계속 발생하면 DLL의 잘못된 경로를 참조하지 않을 수 있습니다. IIS 관리자로 이동하여 DLL을 사용하는 웹 사이트를 클릭하십시오. 오른쪽 창에서 고급 설정을 클릭하고 파일 탐색기의 실제 경로 폴더 경로로 이동 한 다음이 폴더를 사용하여 DLL을 바꾸고 있는지 확인하십시오.


확인해야 할 사항 :

프로젝트 참조를 다시 확인 했습니까?

Visual Studio 시작 웹 서버가 아직 실행 중입니까? 시스템 트레이를 확인하고 톱니 바퀴 아이콘이있는 페이지를 찾습니다 (두 개 이상있을 수 있음).

대체 텍스트
(출처 : msdn.com )

마우스 오른쪽 버튼을 클릭하고 닫거나 종료합니다. 둘 이상있을 수 있습니다. 지금 변경 사항을 디버깅 할 수 있습니까?

디버그 버전을 실행하고 있지만 릴리스 버전 만 빌드 했습니까 (또는 그 반대의 경우)?

컴파일이 실제로 성공 했습니까? "오류가 있습니다. 그래도 계속 하시겠습니까?"를 클릭했습니다. 깨닫지 않고 몇 번 메시지를 보냅니다.


With web services, the problem can be caused by using the Visual Studio "View in Browser" command. This places the service's DLL and PDB files in the bin and obj folders. When stepping into the web service from a client, somehow Visual Studio uses the PDB in the bin (or obj) folder, but it uses the DLL in the project's output build folder. There are a couple workarounds:

  1. Try deleting the DLL and PDB files in the web service bin and obj files.
  2. Try clicking "View in Browser" in Visual Studio.

If you previously got the source file mismatch error, Visual Studio might have added the filename to a black list. Check your solution properties. Choose "Common Properties -> Debug Source Files" on the left side of the dialog box. If your web service source files appear in the field "Do not look for these source files", delete them.


I just had this issue.

I tried all the above, but only this worked:

  • delete the .pdb file for the solution.
  • delete the offending .obj files (for the file being reported out of sync)

build the solution.

This fixed the issue for all builds moving forward for me.


This is how I fixed the problem in Visual Studio 2010:

1) Change the 'Solutions Configurations' option from "Debug" to "Release"

2) Start debugging

3) Stop debugging and switch the 'Solutions Configurations' option back to "Debug"

This worked for me. Step 3 is optional - it was working fine when I changed it to "Release" but I wanted to change it back.


My solution:

I had included an existing project from a different solution in a new solution file.

I did not notice that when the existing project was rebuilt, it was putting the final output into the NEW solution's output directory. I had a linker path defined to look into the OLD solution's output directory.

Switching my project to search in the new solution's output directory fixed this issue for me.


I had this problem, and it turns out I was running my console application as a windows application. Switching the output type back to console fixed the issue.


I had the same problem. To fix it I used the "Release Mode" to debug in VS2013. Which is sufficient for me, because I'm working in a node js\c++ addon.


Unload the project that has the file that is causing the error.

Reload the project.

Fixed


In Visual Studio 2017 deleting the hidden .vs folder in the resolved this issue for me.


My problem was that I had two projects in my solution. The second one was a test project used to call the first one. I had picked the path to the references from the bin folder's release folder.

So whenever I made a change to the first project's code and rebuilt it, it would update the dlls in the debug folder but the calling project was pointing to the release folder, giving me the error, "the source file is different from when the module was built."

Once I deleted the reference to the main project's dll in the release folder and set it to the dll in the debug folder, the issue went away.


solution:- the problem is:- if your some projects in a solution , refer to some other projects, then sometimes the dll of some projects, will not update automatically, whenever you build the solution, some projects will have previous build dlls, not latest dlls

you have to go manually and copy the dll of latest build project into referenced project


I was using Visual Studio 2013 and I had an existing project under source control.
I had downloaded a fresh copy from source control to a new directory.
After making changes to the fresh copy, when building I received the error in question.

My solution:
1) Open Documents\IISExpress\config\applicationhost.config
2) Update virtualDirectory node with directory to the fresh copy and save.


My problem was that I had a webservice in the project and I changed the build path.

Restoring the default build path solved my issue.


I had this same problem and I followed the majority of the guidance in the other answers posted here, nothing seemed to work for me.

I eventually opened IIS and recycled the application pool for my web application. I have IIS version 8.5.9600, I right-clicked my web application, then: Deploy > Recycle > Recycle application pool > OK.

That seems to have fixed it, breakpoints now being hit as expected. I think that doing this along with deleting the bin and obj folders helped my situation.

Good luck!


I know this is an old question but I just had the same problem and wanted to post here in case it helps someone else. I got a new computer and the IT dept merged my old computer with the new one. When I set up TFS, I mapped a different local path than what I was previously using, to an additional internal drive. The old path still existed from the merged data on my hard drive so I could still build and run. My IIS paths were also pointing to the old directory. Once I updated IIS to the correct path, I was able to debug just fine. I also deleted the old directory for good measure.


I also experienced that. I just open the obj folder on the project and then open the debug folder delete the .pdb file and that's all.


This error also happens if you try to make changes to a source file that is not part of the project.

I was debugging a method from a .dll of another one of my projects, where Visual Studio had quite helpfully loaded the source because the .dll had been built on the same machine and it knew the path to the source. Obviously, changing such a file isn't going to do anything unless you rebuild the referenced project.


  1. Delete all breakpoints.
  2. Rebuild.
  3. Done

At Visual Studio 2015, using C++, what fixed for me the the source file is different from when the module was built problem was

  • restart Visual Studio.

Debug-> start without debugging.

This option worked for me. Hope this helps!


Check if the location you pointed to using mex() in Matlab is correct (contains lib and obj files which are modified to the last date you compiled the library in Visual studio).

If this is not the case:

Make sure you are compiling Visual studio in a mode that saves .lib files :

  1. properties -> Config properties -> General -> Config type -> static library

  2. properties -> Config properties -> General -> Target extension=.lib (instead of exe)

Make sure the output and intermediate directories match the Matlab directory in

  1. properties -> Config properties -> General -> Output directory
  2. properties -> Config properties -> General -> Intermediate directory

In my case, the @Eliott's answer doesn't work. To solve this problem I had Exclude/Include From Project my deficient file, andalso Clean and Rebuild the solution.

After these actions, my file with my last modifications and the debugger are restored.

I hope this help.


때때로 Visual Studio에서 디버깅 할 때이 문제가 발생하지만 응용 프로그램이 IIS에서 제공 될 때 발생합니다 . (원래 개발자가이 프로젝트를 설정 한 방법과 관련된 몇 가지 복잡한 이유로이 형식으로 개발해야합니다.)

나는 때 파일을 변경하고 다시 그 수정 그것은 많은 시간을. 어리석게 들리 겠지만 한동안 변경하지 않았는데 왜 이상한 일이 일어나는지 확인하기 위해 일부 코드를 디버그하려고했는데이 페이지에서 여러 가지 작업을 시도했지만 변경만으로 해결되었습니다. 파일..

참고 URL : https://stackoverflow.com/questions/3087390/the-source-file-is-different-from-when-the-module-was-built

반응형