在新的 Azure Functions 项目中复制“System.Reflection.AssemblyCompanyAttribute”属性

Jer*_*y61 9 c# visual-studio-code

当我想要将新项目部署到 Azure 时,我收到许多错误消息。

AssemblyInfo.cs:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("Newfunctions")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Newfunctions")]
[assembly: System.Reflection.AssemblyTitleAttribute("Newfunctions")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

// Generated by the MSBuild WriteCodeFragment class.
Run Code Online (Sandbox Code Playgroud)

错误信息:

Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute [Newfunctions]
Duplicate 'System.Reflection.AssemblyConfigurationAttribute' attribute [Newfunctions]
Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute [Newfunctions]
Duplicate 'System.Reflection.AssemblyInformationalVersionAttribute' attribute [Newfunctions]
Duplicate 'System.Reflection.AssemblyProductAttribute' attribute [Newfunctions]
Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute [Newfunctions]
Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute [Newfunctions]
Run Code Online (Sandbox Code Playgroud)

AssemblyAttributes.cs 中的另一个:

// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]
Run Code Online (Sandbox Code Playgroud)

错误信息:

Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute [Newfunctions]
Run Code Online (Sandbox Code Playgroud)

我在程序集类中没有添加或更改任何内容。我仅在 Visual Studio Code 中安装了 Azure Functions 扩展和 PlayFab Explorer 扩展。此外,我已将 nuget 包 PlayFabAllSDK 和 PlayFabCloudScriptPlugin 添加到我的项目中。我不知道我做错了什么。

我的项目出了什么问题?我该如何修复这些错误消息?

错误信息

新功能.csproj:

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.7"/>
<PackageReference Include="PlayFabAllSDK" Version="1.81.200914"/>
<PackageReference Include="PlayFabCloudScriptPlugin" Version="1.53.190627-alpha"/>
</ItemGroup>
<ItemGroup>
<None Update="host.json">
  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  <CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)

Ann*_*sen 11

添加<GenerateAssemblyInfo>false</GenerateAssemblyInfo>到项目文件对我来说不起作用。

然而,有效的是删除binobj发生错误的所有项目中的然后重新启动 Visual Studio 并尝试再次运行。