vscode-azurefunctions icon indicating copy to clipboard operation
vscode-azurefunctions copied to clipboard

There are 'duplicate attribute' errors for .AssemblyInfo.cs file after deployment

Open v-ruizh opened this issue 6 years ago • 5 comments

OS: Windows Node.js: V10.15.0 Build Version: 20190402.1 Azure Functions Core Tools: V2.4.498

Repro Steps:

  1. Create a C# project.
  2. Create a new function with 'HTTP trigger' template and 'Function' level.
  3. Deploy this C# project to Azure Function app.
  4. Wait for 1 minute and click 'PROBLEMS' panel to check the logs.

Expect: There is no error in 'PROBLEMS' panel.

Actual: There are 'duplicate attribute' errors for .AssemblyInfo.cs file. image

More Info:

  1. This issue don't reproduce for JavaScript/TypeScript and Python project.
  2. This issue also reproduces on Azure Function extension previous release build 0.16.0.

v-ruizh avatar Apr 03 '19 09:04 v-ruizh

This happens because there is an AssemblyInfo file in both the "Debug" and "Release" folder. Once https://github.com/OmniSharp/omnisharp-vscode/issues/1694 is fixed, we should be able to leverage the files.exclude setting to hide the "obj" folder and any of its errors

ejizba avatar May 07 '19 18:05 ejizba

Filed a new issue on omnisharp: https://github.com/OmniSharp/omnisharp-vscode/issues/3050

ejizba avatar May 07 '19 20:05 ejizba

Solution: Before debugging, add the following lines to each of the *.csproj files within the <PropertyGroup> section:

    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
    <GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
    <GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
    <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
    <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>

Screenshot from 2021-03-09 21-58-21

behnood-eghbali avatar Mar 09 '21 18:03 behnood-eghbali

How is this still an issue two and a half years later? This is a bug that pretty much anyone using Microsoft's flagship programming language running on their flagship serverless technology will encounter.

MikePennington avatar Nov 01 '21 15:11 MikePennington

Hi @MikePennington

I understand your frustration, but unfortunately this is stemming from the OmniSharp extension.

We're tracking both of those issues, but unless we edit user's .csproj files manually to include the changes mentioned here: https://github.com/microsoft/vscode-azurefunctions/issues/1154#issuecomment-794286543, there is not much the Azure Functions extension team can do about it.

nturinski avatar Nov 01 '21 20:11 nturinski