无法找到Areas \ HelpPage \ *(例如ApiDescriptionExtensions.cs)

时间:2014-04-18 17:29:46

标签: .net compiler-errors nuget

最近的例行更新打破了我的项目的编译。 出现了许多错误,包括:Areas\HelpPage\ApiDescriptionExtensions.cs could not be found。 在进行项目范围的搜索时,未找到对这些文件的引用。

根据源代码管理,packages.config中发生了以下更改:

-   <package id="Microsoft.AspNet.Mvc" version="5.1.1" targetFramework="net45" />
-   <package id="Microsoft.AspNet.Razor" version="3.1.1" targetFramework="net45" />
-   <package id="Microsoft.AspNet.Web.Optimization" version="1.1.2" targetFramework="net45" />
-   <package id="Microsoft.AspNet.WebApi" version="5.1.1" targetFramework="net45" />
-   <package id="Microsoft.AspNet.WebApi.Client" version="5.1.1" targetFramework="net45" />
-   <package id="Microsoft.AspNet.WebApi.Core" version="5.1.1" targetFramework="net45" />
-   <package id="Microsoft.AspNet.WebApi.HelpPage" version="5.1.1" targetFramework="net45" />
-   <package id="Microsoft.AspNet.WebApi.WebHost" version="5.1.1" targetFramework="net45" />
-   <package id="Microsoft.AspNet.WebPages" version="3.1.1" targetFramework="net45" />
+   <package id="Microsoft.AspNet.Mvc" version="5.1.2" targetFramework="net45" />
+   <package id="Microsoft.AspNet.Razor" version="3.1.2" targetFramework="net45" />
+   <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
+   <package id="Microsoft.AspNet.WebApi" version="5.1.2" targetFramework="net45" />
+   <package id="Microsoft.AspNet.WebApi.Client" version="5.1.2" targetFramework="net45" />
+   <package id="Microsoft.AspNet.WebApi.Core" version="5.1.2" targetFramework="net45" />
+   <package id="Microsoft.AspNet.WebApi.WebHost" version="5.1.2" targetFramework="net45" />
+   <package id="Microsoft.AspNet.WebPages" version="3.1.2" targetFramework="net45" />

为什么例程库更新会导致与看似无关的文件相关的错误,  以及如何解决? (Q&amp; A格式)

1 个答案:

答案 0 :(得分:4)

我执行了一个内部文件内容搜索,找到其中一个文件ApiDescriptionExtensions的名称,该文件返回了对.csproj文件的引用。

编译器错误的解决方案是从.csproj中删除对违规文件的引用(具体参考文献如下所示)。

我怀疑Microsoft.AspNet.WebApi.HelpPage的安装是由于文件名引起的问题,但由于此类文件不会突然存在而导致构建中断似乎是Microsoft或NuGet软件包维护人员需要的错误修复,即使这些文件在项目创建时存在并且稍后被删除。

删除以下.csproj行允许项目再次构建:

<Compile Include="Areas\HelpPage\ApiDescriptionExtensions.cs" />
<Compile Include="Areas\HelpPage\App_Start\HelpPageConfig.cs" />
<Compile Include="Areas\HelpPage\Controllers\HelpController.cs" />
<Compile Include="Areas\HelpPage\HelpPageAreaRegistration.cs" />
<Compile Include="Areas\HelpPage\HelpPageConfigurationExtensions.cs" />
<Compile Include="Areas\HelpPage\ModelDescriptions\DictionaryModelDescription.cs" />
<Compile Include="Areas\HelpPage\ModelDescriptions\EnumTypeModelDescription.cs" />
<Compile Include="Areas\HelpPage\ModelDescriptions\EnumValueDescription.cs" />
<Compile Include="Areas\HelpPage\ModelDescriptions\IModelDocumentationProvider.cs" />
<Compile Include="Areas\HelpPage\ModelDescriptions\KeyValuePairModelDescription.cs" />
<Compile Include="Areas\HelpPage\ModelDescriptions\ModelDescription.cs" />
<Compile Include="Areas\HelpPage\ModelDescriptions\ModelDescriptionGenerator.cs" />
<Compile Include="Areas\HelpPage\ModelDescriptions\ModelNameAttribute.cs" />
<Compile Include="Areas\HelpPage\ModelDescriptions\ModelNameHelper.cs" />
<Compile Include="Areas\HelpPage\ModelDescriptions\ParameterAnnotation.cs" />
<Compile Include="Areas\HelpPage\ModelDescriptions\ParameterDescription.cs" />
<Compile Include="Areas\HelpPage\ModelDescriptions\SimpleTypeModelDescription.cs" />
<Compile Include="Areas\HelpPage\Models\HelpPageApiModel.cs" />
<Compile Include="Areas\HelpPage\SampleGeneration\HelpPageSampleGenerator.cs" />
<Compile Include="Areas\HelpPage\SampleGeneration\HelpPageSampleKey.cs" />
<Compile Include="Areas\HelpPage\SampleGeneration\ImageSample.cs" />
<Compile Include="Areas\HelpPage\SampleGeneration\InvalidSample.cs" />
<Compile Include="Areas\HelpPage\SampleGeneration\ObjectGenerator.cs" />
<Compile Include="Areas\HelpPage\SampleGeneration\SampleDirection.cs" />
<Compile Include="Areas\HelpPage\SampleGeneration\TextSample.cs" />
<Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" />

如您所见,只需删除包含对Areas\HelpPage

的引用的每一行