Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Source file in CSC cannot be found

After a struggle with creating a database (first with an entity framework, after without), we have a database (and an EntityModel_HFFContext file we don't use, it's not connected). Normal work proceeded, and I installed a NuGet-package for an MVC sitemap.

From that moment, the project worked fine, but after a couple of days two warnings came up about two files missing: "The parent file, 'EntityModel_HFF.tt', for file 'locatie.cs' cannot be found in the project file." ("HFF" is the project name in here) and then those multiplied themselves into errors: "Source file 'locatie.cs' cannot be found" in a CSC file I cannot find.

These two files ('locatie.cs' and 'klant.cs') are not in any view, but somehow they are displayed outside all folders, saying they do not excist (see this screencapture). I have tried to delete those files manually, but that did not have any success. I have tried some other ways too, but that resulted into the complete deletion of the database, so now I am somewhat desperate.

I have no idea where to look and what to do, to get rid of these two files (or probably references to these files, since we don't use them at all), so I don't have these errors anymore. Has anyone of you have a clue of where I need to look (e.g. where this CSC file is) and what I need to adjust to fix this?

Maybe it can be useful to know I use Visual Studio 2013.

Update

I fixed the errors by unloading the project, editing the .csproj file and commenting out

<Compile Include="klant.cs">
    <DependentUpon>EntityModel_HFF.tt</DependentUpon>
</Compile>

(and the other one too). Now these errors are gone - is this a safe way to do this?

like image 743
roye7777777 Avatar asked Dec 27 '14 13:12

roye7777777


People also ask

Where is the CSC file?

Typically, the offline files cache is located in the following directory: %systemroot%\CSC .

How do I open a CSC file in Visual Studio?

For information on how to access this tool, see Developer Command Prompt for Visual Studio. The csc.exe executable file is usually located in the Microsoft.NET\Framework\<Version> folder under the Windows directory. Its location might vary depending on the exact configuration of a particular computer.

What is C# source file?

A CS file is a source code file written in C# (pronounced "C Sharp"), an object-oriented programming language created by Microsoft for use with . NET Framework and . NET (successor to . NET Framework).


1 Answers

The reason why you get the error is because when you deleted the locatie.cs and klant.cs file, you didn't remove them from the project solution itself, therefore, Visual Studio is expecting the file to be part of the project but is unable to find them, which explains the yellow warning signs.

Like what you said, all you have to do is to remove the files from the solution as they no longer exists. So yes, it is safe to comment out that portion in the .csproj file.

Although, I would like to mention that you didn't have to go to that much trouble, all you had to do was to delete the file in your solution in Visual Studio, since they no longer exists anyway.

like image 61
Dan Avatar answered Oct 08 '22 16:10

Dan