C# 错误CS0234:类型或命名空间名称';实体';命名空间中不存在';系统数据';VSTS(DevOps)
请纠正我的错误,我在构建管道事件中不断出现上述错误,尽管我已将路径设置为动态路径,如下所示:C# 错误CS0234:类型或命名空间名称';实体';命名空间中不存在';系统数据';VSTS(DevOps),c#,msbuild,azure-devops,azure-pipelines-build-task,C#,Msbuild,Azure Devops,Azure Pipelines Build Task,请纠正我的错误,我在构建管道事件中不断出现上述错误,尽管我已将路径设置为动态路径,如下所示: <PropertyGroup> <!-- EnlistmentRoot is the base directory where all of the module root directories reside. --> <EnlistmentRoot>$(MSBuildThisFileDirectory)</Enlis
<PropertyGroup>
<!-- EnlistmentRoot is the base directory where all of the module root directories reside. -->
<EnlistmentRoot>$(MSBuildThisFileDirectory)</EnlistmentRoot>
<EnlistmentRoot Condition="'$(EnlistmentRoot)' != ''">$([System.IO.Path]::GetFullPath('$(EnlistmentRoot)'))</EnlistmentRoot>
<EnlistmentRoot Condition="'$(EnlistmentRoot)' != '' and !HasTrailingSlash('$(EnlistmentRoot)')">$(EnlistmentRoot)\</EnlistmentRoot>
</PropertyGroup>
<PropertyGroup>
<!-- NuGetPackagesPath is the base directory for all nuget packages. -->
<NuGetPackagesPath>$(EnlistmentRoot)..\packages</NuGetPackagesPath>
<NuGetPackagesPath Condition="'$(NuGetPackagesPath)' != ''">$([System.IO.Path]::GetFullPath('$(NuGetPackagesPath)'))</NuGetPackagesPath>
<NuGetPackagesPath Condition="'$(NuGetPackagesPath)' != '' and !HasTrailingSlash('$(NuGetPackagesPath)')">$(NuGetPackagesPath)\</NuGetPackagesPath>
</PropertyGroup>
<Reference Include="EntityFramework">
<HintPath>$(NugetPackagesPath)\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer">
<HintPath>$(NugetPackagesPath)\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServerCompact">
<HintPath>$(NugetPackagesPath)\EntityFramework.SqlServerCompact.6.1.3\lib\net45\EntityFramework.SqlServerCompact.dll</HintPath>
</Reference>
$(MSBuildThisFileDirectory)
$([System.IO.Path]::GetFullPath(“$(登记根)”)
$(登记根)\
$(登记根)…\packages
$([System.IO.Path]::GetFullPath(“$(NuGetPackagePath)”)
$(NuGetPackagePath)\
$(NuGetPackagePath)\EntityFramework.6.1.3\lib\net45\EntityFramework.dll
$(NuGetPackagePath)\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll
$(NuGetPackagePath)\EntityFramework.SqlServerCompact.6.1.3\lib\net45\EntityFramework.SqlServerCompact.dll
错误CS0234:中不存在类型或命名空间名称“实体”
命名空间“System.Data”
此错误消息表示生成过程找不到来自还原的nuget包的程序集。因此,您应该检查生成管道中的还原任务的日志,以确保成功还原包
1.在执行类似的构建
任务之前,确保您有使用nuget
和nuget恢复
任务(避免使用与dotnet相关的任务,因为您的项目目标是.net framework
):
2.如果在nuget restore
任务成功时问题仍然存在,请检查nuget restore
任务的日志以查找包的存储位置:
然后检查build
任务的日志,了解msbuild如何识别路径,如$(NuGetPackagePath)\EntityFramework.6.1.3…
:
我们应该确保还原包的路径(还原任务)和msbuild获取程序集所使用的路径相同!对于这一点,你可能会得到一些帮助
另外:不确定为什么使用自定义的$(NuGetPackagePath)
而不是普通的
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
</Reference>
..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll
对于#2,您还可以将
的格式更改为常规方式,以检查问题是否得到解决
希望有帮助,如果我误解了什么,请随时纠正我:)朋友,请检查问题是否仍然存在,如果仍然阻碍您,请随时通知我:)