Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does C# encounter this error as to the CSC file?

Tags:

c#

.net

asp.net

csc

I am pretty new in C# development and I have the following problem.

When I try to build the application on which I am working I obtain the followings errors message:

Error   2   Source file 'Log\LogUserManager.cs' could not be found  C:\Develop\MyFramework4.0\MyManagerCSharp\CSC   MyManagerCSharp
Error   8   Source file 'AntiPhishing.cs' could not be found    C:\Develop\EarlyWarning\public\Implementazione\Ver2\UnitTestProject\CSC UnitTestProject

It seeams to me that these errors appeared after an SVN update.

Why? What exactly means? If I click on the error line it don't take me to the code line where the error appear. What is the CSC file? How can try to fix this issue?

Tnx

like image 478
AndreaNobili Avatar asked Jul 16 '14 08:07

AndreaNobili


People also ask

Why is %d used in C?

In C programming language, %d and %i are format specifiers as where %d specifies the type of variable as decimal and %i specifies the type as integer. In usage terms, there is no difference in printf() function output while printing a number using %d or %i but using scanf the difference occurs.

Why is C not A or B?

Because C comes after B The reason why the language was named “C” by its creator was that it came after B language. Back then, Bell Labs already had a programming language called “B” at their disposal.

Why semicolon is used in C?

Semicolons are end statements in C. The Semicolon tells that the current statement has been terminated and other statements following are new statements. Usage of Semicolon in C will remove ambiguity and confusion while looking at the code.

Why do we write in C?

It was mainly developed as a system programming language to write an operating system. The main features of the C language include low-level memory access, a simple set of keywords, and a clean style, these features make C language suitable for system programmings like an operating system or compiler development.


6 Answers

These are not errors in the code but errors in the references of your project. Check that the references are indeed located where they point.

It is possible that when doing your SVN update, some source files have been moved but you didn't update your .csproj containing the references to these files.

like image 147
Padrus Avatar answered Oct 06 '22 00:10

Padrus


This question occurred a long time ago, but for others that view this, make sure that the c# files are on your hard drive. Sometimes the Solution Explorer shows that they are there, but they aren't.

like image 29
Daniel King Avatar answered Oct 06 '22 00:10

Daniel King


This can also happen if you renamed your startup class, but didn't update the startup object in your project settings.

like image 28
Dan Avatar answered Oct 05 '22 23:10

Dan


After trying almost everything this is what I found:

The root cause of the problem is garbage in the .csproj or Project file. In order to find the problem do the following:

  1. Right click and Unload the project file
  2. Right click and Edit the project file
  3. Search on the text for the reference that is giving you errors, probably will be in a
  4. Delete it or fix the entry.
  5. Right click and Reload Project.
like image 24
Abdul Martinez Avatar answered Oct 06 '22 01:10

Abdul Martinez


For posterity, it is also worth noting that if you enabled the XML documentation file in Visual Studio (project properties > Build > Output), set an absolute path to it, and then push it to your code repository of choice, anyone pulling your code and not verifying this will encounter a particularly unspecified error in the CSC file. Should this be the case, even doing a clean build will produce the error in all individuals who pulled your code (assuming the path does not exist on their system).

In this scenario, the path should be removed from this and only the filename should be left.

I do not know if other compilers will encounter this issue, but it is worth looking into as well.

like image 40
Nicolas Coombs Avatar answered Oct 06 '22 01:10

Nicolas Coombs


Cleaning the solution helped resolve some of my dll not found errors, in the CSC file. Not sure your specific error but cleaning/rebuilding might be helpful to try if you haven't already.

like image 38
Chris997422 Avatar answered Oct 06 '22 00:10

Chris997422