I have a solution where the file name and line number of the error isn't displaying in the Error List, unless I have the file open.
I have another solution where just three errors show up when I build the solution, and they do display the line number and file. If I open the file with the error, another 3 errors pop up, but when I close the file, all the errors disappear until I rebuild again.
The only issue I've seen from googling is that the path is too long or too weird, but I don't think this is an issue. Path is C:\TFS\Apps\Rel_2013.7.1\S3\CrmSvcUtil Extensions
for the solution that is partially working and C:\TFS\Apps\Rel_2013.7.1\S3
for the one that doesn't work at all.
Just to make it clear what I'm seeing: I have multiple projects in my solution but one of them doesn't show the file or line number of the error unless the file is open.
In this screen shot I've added two dumb errors, each in a different project, and have built the solution. The Test Project displays the file and line number as expected. The Common project isn't displaying the file or line number error even though it should and does when I actually open the file with the error in it. The Warning isn't displaying the file because it is a project level warning, not a file level warning, this makes sense.
When I open the file with the error the file name and the line number do show up, but on a different error:
If I change the int to a string, only the line numbered error is removed. I actually have to build in order for the error to be removed.
I had the same issue on projects that are using legacy Workflow framework V3. Interesting to note, that if project has only compiler warnings, the file and line are shown correctly, but error causing all warnings and errors refer to file C:\Windows\Microsoft.NET\Framework\v4.0.30319\Workflow.Targets(121,5):
The nasty workaround that I found is
<Import Project="$(MSBuildToolsPath)\Workflow.Targets" />
The similar solution was reported to MS https://connect.microsoft.com/VisualStudio/feedback/details/797056/state-machine-workflow-projects-using-vs-2012
If you forget to restore Workflow.Targets import, there will be run-time errors like
System.Workflow.ComponentModel.Compiler.WorkflowValidationFailedException: The workflow failed validation.
at System.Workflow.Runtime.WorkflowDefinitionDispenser.ValidateDefinition(Activity root, Boolean isNewType, ITypeProvider typeProvider)
at System.Workflow.Runtime.WorkflowDefinitionDispenser.LoadRootActivity
Certain errors such as schema errors are reported but don't affect the final build. Depending on the file you may/may not see errors unless the file is open. Here are some things to try
MSBuild Project Build Output Verbosity
(Tools-> Projects & Solutions -> Build and Run) to see if that has an effect. I surmise that will only add to the output but not affect on the Error List Window.It is not unusual there to be differences between output builds and intellisense errors as reported.
Sounds to me like you are just looking at errors that are generated by the IntelliSense parser. Which only looks at open files. When you close the file then those IS errors will be removed from the list again. Seeing the error list change after you've built and open a file is similarly explained, the IS parser takes over again.
This is all by design, get ahead by just fixing the errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With