'CSC:CSC(0,0): Error CS2001: Source file [file

2020-05-06 14:03发布

I appear to have got in a bit of a mixup with my project and whenever a gated build and check in runs, I get the following errors.....

Summary
| Phase 1
15 error(s), 602 warning(s) 
Phase 1 - 15 error(s), 602 warning(s) 
CSC:CSC(0,0): Error CS2001: Source file 'd:\a\3\s\Main\SmartEndPointAssessment\SA.SEPA.Web.UI.Selenium\Features\AssessmentCentreEpaFeatures.feature.cs' could not be found.
CSC:CSC(0,0): Error CS2001: Source file 'd:\a\3\s\Main\SmartEndPointAssessment\SA.SEPA.Web.UI.Selenium\Features\AssessmentCentreFeatures.feature.cs' could not be found.
CSC:CSC(0,0): Error CS2001: Source file 'd:\a\3\s\Main\SmartEndPointAssessment\SA.SEPA.Web.UI.Selenium\Features\AssessorEpaFeatures.feature.cs' could not be found.
CSC:CSC(0,0): Error CS2001: Source file 'd:\a\3\s\Main\SmartEndPointAssessment\SA.SEPA.Web.UI.Selenium\Features\AssessorFeatures.feature.cs' could not be found.
CSC:CSC(0,0): Error CS2001: Source file 'd:\a\3\s\Main\SmartEndPointAssessment\SA.SEPA.Web.UI.Selenium\Features\ClientSettingsFeatures.feature.cs' could not be found.
CSC:CSC(0,0): Error CS2001: Source file 'd:\a\3\s\Main\SmartEndPointAssessment\SA.SEPA.Web.UI.Selenium\Features\CustomFieldFeatures.feature.cs' could not be found.
CSC:CSC(0,0): Error CS2001: Source file 'd:\a\3\s\Main\SmartEndPointAssessment\SA.SEPA.Web.UI.Selenium\Features\EmployerFeatures.feature.cs' could not be found.
CSC:CSC(0,0): Error CS2001: Source file 'd:\a\3\s\Main\SmartEndPointAssessment\SA.SEPA.Web.UI.Selenium\Features\LoginFeatures.feature.cs' could not be found.
CSC:CSC(0,0): Error CS2001: Source file 'd:\a\3\s\Main\SmartEndPointAssessment\SA.SEPA.Web.UI.Selenium\Features\MyProfileFeatures.feature.cs' could not be found.
CSC:CSC(0,0): Error CS2001: Source file 'd:\a\3\s\Main\SmartEndPointAssessment\SA.SEPA.Web.UI.Selenium\Features\ReportFeatures.feature.cs' could not be found.
CSC:CSC(0,0): Error CS2001: Source file 'd:\a\3\s\Main\SmartEndPointAssessment\SA.SEPA.Web.UI.Selenium\Features\SettingsFeatures.feature.cs' could not be found.

All these files exist in my local path, and my solution builds and runs. Its when I try to check in I get the errors above.

Looking at the code in source control, the files don't exist. Also these files don't have the '+' icon next to them in solution explorer.

enter image description here

This is the folder in VSTS...

enter image description here

How do I get source control to recognize and add these files?

Thanks,

1条回答
等我变得足够好
2楼-- · 2020-05-06 14:35

According to your screenshoot and the file already checked in TFS source control. Afraid the root cause of the error you got in short currently its the TFVC limitation, from

Must not contain more than 259 Unicode characters for a single folder or file name.

Source Link: Version control paths

You have to manually tweak your file/folder structure in TFS source control to bypass this issue. From C:\Agent\_work\1\s\TestCaseProject to C:\Agent\_work\1\s\TestCasePro

Reduce the full path length of those files, by reducing the length of the name and/or the length of the container folder or reducing the folder nesting level. Therefore reducing the full path length.

You could also take a look at this similar question: MSBuild error "CSC : error CS2001: Source File 'x' could not be found" with Linked Files after upgrading to Visual Studio 2012

查看更多
登录 后发表回答