我有一个使用System.ValueTuple的.NetStandard项目。
无论我是否包含System.ValueTuple nuget软件包,它都可以在Visual Studio中很好地构建。
但是当我在团队城市构建它时,无论哪种方式都会失败,并显示以下错误:
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>
答案 0 :(得分:0)
您很可能需要添加对System.ValueTuple.dll的引用。您可以通过从nuget安装System.ValueTuple软件包来完成此操作。
答案 1 :(得分:0)
当我开始使用DotNet Restore代替Nuget Restore时,错误消失了。
我不知道为什么。