c# - 新 Azure Functions 项目中的“System.Reflection.AssemblyCompanyAttribute”属性重复
问题描述
当我想将我的新项目部署到 Azure 时,我收到许多错误消息。
装配信息.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.
错误信息:
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]
AssemblyAttributes.cs 中的另一个:
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]
错误信息:
Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute [Newfunctions]
我在程序集类中没有添加或更改任何内容。我只在 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>
解决方案
添加<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
到项目文件对我不起作用。然而,起作用的是删除所有发生错误的项目中的bin和obj文件夹。然后重新启动 Visual Studio 并尝试再次运行。
推荐阅读
- java - 将文本文件的值存储在列表列表中
- openssl - testssl.sh 致命错误 没有可用的 IPv4/IPv6 地址
- javascript - React-native:尝试打印依赖于 data.child 的数据
- javascript - 滚动顶部不起作用
- mysql - 带条件的 SQL 选择查询
- c# - 设置基本身份验证 c# 以调用肥皂网络服务
- python - 试图在其他 Python 程序中调用 python 文件
- google-cloud-platform - Google Cloud Datastore 中是否可能出现写入偏斜异常?
- python - 如何在我的服务器上启用 SSL?
- python - 为什么我收到 SyntaxError:关于使用 elif 语句的语法无效?