'CSC:CSC(0,0):错误CS2001:找不到源文件[文件]。在运行门禁登记时(C#)

时间:2017-11-27 18:20:33

标签: c# visual-studio tfs azure-devops

我似乎与我的项目有点混淆,每当门控构建和签入运行时,我都会遇到以下错误......

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.

所有这些文件都存在于我的本地路径中,我的解决方案构建并运行。当我尝试登记时,我得到了上述错误。

查看源代码管理中的代码,文件不存在。此外,这些文件在解决方案资源管理器中旁边没有“+”图标。

enter image description here

这是VSTS中的文件夹...

enter image description here

如何让源代码控制识别并添加这些文件?

谢谢,

1 个答案:

答案 0 :(得分:1)

根据您的截屏和已在TFS源代码管理中检查的文件。你可以从

那里看到错误的根本原因
Must not contain more than 259 Unicode characters for a single folder or file name.
     

来源链接:Version control paths

您必须在TFS源代码管理中手动调整文件/文件夹结构才能绕过此问题。从C:\Agent\_work\1\s\TestCaseProjectC:\Agent\_work\1\s\TestCasePro

通过减少容器文件夹的名称长度和/或长度或减少文件夹嵌套级别来减少这些文件的完整路径长度。因此减少了全路径长度。

你也可以看看这个类似的问题:MSBuild error "CSC : error CS2001: Source File 'x' could not be found" with Linked Files after upgrading to Visual Studio 2012