在 .NetStandard 2.0 项目中构建 System.ValueTuple 时出错
Error when building System.ValueTuple in .NetStandard 2.0 project
我有一个使用 System.ValueTuple.
的 .NetStandard 项目
无论我是否包含 System.ValueTuple nuget 包,它在 visual studio 中都构建良好。
然而,当我在 team-city 上构建它时,无论哪种方式都失败并出现错误:
error CS8137: Cannot define a class or member that utilizes tuples because the compiler required type 'System.Runtime.CompilerServices.TupleElementNamesAttribute' cannot be found. Are you missing a reference?
Teamcity 托管在具有最新的 .Net Core SDK 和最新的 .NetFramework SDK 的环境中。
当我将目标框架更改为 .NetCoreApp2.0 时,它构建良好。
关于可能发生的事情有什么想法吗?
作为参考,这是我的 csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<Version>$(VersionSuffix)</Version>
<Authors>**********</Authors>
<Product>**********</Product>
<Description>**********</Description>
<PackageTags>**********</PackageTags>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Copyright>**********</Copyright>
<PackageProjectUrl>http://**********</PackageProjectUrl>
<PackageLicenseUrl>http://**********</PackageLicenseUrl>
<PackageIconUrl>http://**********</PackageIconUrl>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.4.1" />
<PackageReference Include="RabbitMQ.Client" Version="5.0.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="**********" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\**********" />
</ItemGroup>
您很可能需要添加对 System.ValueTuple.dll 的引用。您可以通过从 nuget 安装 System.ValueTuple 包来完成此操作。
当我开始使用 DotNet Restore 而不是 Nuget Restore 时,错误消失了。
我不知道为什么。
我有一个使用 System.ValueTuple.
的 .NetStandard 项目无论我是否包含 System.ValueTuple nuget 包,它在 visual studio 中都构建良好。
然而,当我在 team-city 上构建它时,无论哪种方式都失败并出现错误:
error CS8137: Cannot define a class or member that utilizes tuples because the compiler required type 'System.Runtime.CompilerServices.TupleElementNamesAttribute' cannot be found. Are you missing a reference?
Teamcity 托管在具有最新的 .Net Core SDK 和最新的 .NetFramework SDK 的环境中。
当我将目标框架更改为 .NetCoreApp2.0 时,它构建良好。
关于可能发生的事情有什么想法吗?
作为参考,这是我的 csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<Version>$(VersionSuffix)</Version>
<Authors>**********</Authors>
<Product>**********</Product>
<Description>**********</Description>
<PackageTags>**********</PackageTags>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Copyright>**********</Copyright>
<PackageProjectUrl>http://**********</PackageProjectUrl>
<PackageLicenseUrl>http://**********</PackageLicenseUrl>
<PackageIconUrl>http://**********</PackageIconUrl>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.4.1" />
<PackageReference Include="RabbitMQ.Client" Version="5.0.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="**********" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\**********" />
</ItemGroup>
您很可能需要添加对 System.ValueTuple.dll 的引用。您可以通过从 nuget 安装 System.ValueTuple 包来完成此操作。
当我开始使用 DotNet Restore 而不是 Nuget Restore 时,错误消失了。
我不知道为什么。