0

I'm trying Azure Functions for the first time and have been able to build and publish "Release" versions without any issue.

I want to step through the code and so need to create and publish a "Debug" version but when I try and build I get the following errors with the same code:

CS0579  Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute
CS0579  Duplicate 'System.Reflection.AssemblyConfigurationAttribute' attribute
CS0579  Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute
CS0579  Duplicate 'System.Reflection.AssemblyInformationalVersionAttribute' attribute
CS0579  Duplicate 'System.Reflection.AssemblyProductAttribute' attribute
CS0579  Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute
CS0579  Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute

From researching this error the main suggestion has been to remove them from the AssemblyInfo.cs file but rebuilds just put them back in again and the "Release" version is happy with these settings being there.

What am I missing so I can create a "Debug" version of the code?

Thanks

2 Answers2

0

According to your description about CS0579 Duplicate error ,I suppose some temporary *.cs files generated during compilation got accidentally added to the project. The files were from the obj\Debug directory, you could try to delete these files to solve problem. For more details, you could refer to this SO thread.

In my case, some temporary *.cs files generated during compilation got accidentally added to the project.

The files were from the obj\Debug directory, so they definitely shouldn't have been added to the solution. A *.cs wildcard went a little crazy and added them incorrectly.

If it doesn't work, there are also other solutions you could have a try. Such as right click project name>choose Edit FunctionName.csproj. Edit the csproj and turn the generation of the attributes causing the issues off. More solutions you could refer to this article.

Resolution

I found this issue on GitHub where there were a couple of options to resolve this issue which I am going to cover here plus a third option I tried not mention in the issue.

Community
  • 1
  • 1
Janley Zhang
  • 1,567
  • 7
  • 11
  • I have tried the suggestions but I still get the same error. If I delete the "assembly" references in the AssemlyInfo.cs file, then I can build a debug version but the "assembly" reference are replaced in the AssemblyInfo.cs file so subsequent builds fail unless I remove them again. – user9674923 Apr 23 '18 at 07:38
  • I have created a httptrigger azure function project. If I choose [debug mode](https://image.ibb.co/d8TGJc/azurefunctiondebug1.png) to publish to Azure portal, it works fine. Did you also choose debug in this? – Janley Zhang Apr 23 '18 at 07:55
0

I have managed to now get the Debug to build by following one of Janley's link and adding 4 extra lines into the .csproj file:

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