BoolBySigma / UpdateAssemblyInfo

SORRY THIS IS NO LONGER MAINTAINED
10 stars 9 forks source link

Add Missing Attributes adds empty attributes #11

Closed bencat86 closed 7 years ago

bencat86 commented 7 years ago

When using the Add Missing Attributes option, it will always add Description, Configuration and Product attributes, even if they are empty. This causes problems when using with assembly info split across multiple files as the compiler will refuse to build with duplicate attributes.

In my specific use case, I'm trying to add InformationalVersion to CommonAssemblyInfo.cs

CommonAssemblyInfo.cs :

[assembly: AssemblyCompany("My Company")]
[assembly: AssemblyCopyright("Copyright © Me 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("1.0.1.15")]
[assembly: AssemblyFileVersion("1.0.1.15")]

Project1\AssemblyInfo.cs :

[assembly: AssemblyTitle("Project One")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("My Product")]
ghost commented 7 years ago

Thank you for pointing this out!

Are you running VSTS och TFS? If TFS, what version of the extension? Could you please run the build with variable system.debug set to true and upload the log?

Have I understood your problem correctly: You leave Description, Configuration and Product empty. Check Add Missing Attributes. Attributes Description, Configuration and Product are still added.

bencat86 commented 7 years ago

Yes, that's the problem.

We're running TFS version 15.112.26307.0, the extension is on version 2.* (it has the new COM Visible option, so should be at least v2.0.27)

ghost commented 7 years ago

If you go to [YOUR_TFS]/DefaultCollection/_admin/_extensions?tab=Manage&status=active (TFS2017, perhaps different on 2015) and click on the "Update Assembly Info" extension you will get the details page and see exactly what version you are runing. Should be something like 2.0.*

Could you please upload a debug log?

bencat86 commented 7 years ago

It's v2.0.29

The assembly info step is as follows:

2017-05-10T09:43:21.9504244Z ##[section]Starting: Update Assembly: **\SharedAssemblyInfo.cs
2017-05-10T09:43:21.9660494Z ==============================================================================
2017-05-10T09:43:21.9660494Z Task         : Update Assembly Info
2017-05-10T09:43:21.9660494Z Description  : Update assembly info of one or multiple projects
2017-05-10T09:43:21.9660494Z Version      : 2.0.29
2017-05-10T09:43:21.9660494Z Author       : Bool (by Sigma)
2017-05-10T09:43:21.9660494Z Help         : Having Problems? Please [create an issue on our Github](https://github.com/BoolBySigma/UpdateAssemblyInfo/issues) and we will try to help you.
2017-05-10T09:43:21.9660494Z ==============================================================================
2017-05-10T09:43:25.4504715Z 
2017-05-10T09:43:25.4661038Z Parameter                                                                                                         Value
2017-05-10T09:43:25.4661038Z ---------                                                                                                         -----
2017-05-10T09:43:25.4661038Z Add Missing Attriutes                                                                                              True
2017-05-10T09:43:25.4817251Z Description                                                                                                            
2017-05-10T09:43:25.4817251Z Configuration                                                                                                          
2017-05-10T09:43:25.4817251Z Company                                                                                                                
2017-05-10T09:43:25.4817251Z Product                                                                                                                
2017-05-10T09:43:25.4817251Z Copyright                                                                                                              
2017-05-10T09:43:25.4817251Z Trademark                                                                                                              
2017-05-10T09:43:25.4817251Z Informational Version                                                                               3.4.0$(date:+yyMMdd
2017-05-10T09:43:25.4817251Z Com Visible                                                                                                            
2017-05-10T09:43:25.4817251Z File Version                                                                                                 3.4.0.2002
2017-05-10T09:43:25.4817251Z Assembly Version                                                                                               3.4.0.19
2017-05-10T09:43:25.4975960Z 
2017-05-10T09:43:25.4975960Z 
2017-05-10T09:43:27.1536171Z Updating...
2017-05-10T09:43:27.2786199Z Updated:
2017-05-10T09:43:27.3098799Z 
2017-05-10T09:43:27.3098799Z File                                    FileVersion                             AssemblyVersion                        
2017-05-10T09:43:27.3098799Z ----                                    -----------                             ---------------                        
2017-05-10T09:43:27.3098799Z C:\BuildAgent\agent_02\_work\13\s\Sh... 3.4.0.2002                              3.4.0.19                               
2017-05-10T09:43:27.3098799Z 
2017-05-10T09:43:27.3098799Z 
2017-05-10T09:43:27.4973711Z ##[section]Finishing: Update Assembly: **\SharedAssemblyInfo.cs

The build step fails with:

...
2017-05-10T09:43:43.0289075Z          Properties\AssemblyInfo.cs(9,12): error CS0579: Duplicate 'AssemblyDescription' attribute [C:\BuildAgent\agent_02\_work\13\s\SQLiteDB\SQLiteDB.csproj]
2017-05-10T09:43:43.0289075Z          Properties\AssemblyInfo.cs(10,12): error CS0579: Duplicate 'AssemblyConfiguration' attribute [C:\BuildAgent\agent_02\_work\13\s\SQLiteDB\SQLiteDB.csproj]
2017-05-10T09:43:43.0289075Z          Properties\AssemblyInfo.cs(11,12): error CS0579: Duplicate 'AssemblyProduct' attribute [C:\BuildAgent\agent_02\_work\13\s\SQLiteDB\SQLiteDB.csproj]
...
ghost commented 7 years ago

To get the debug log: Run the build with variable system.debug set to true Could you upload the txt log file. Easier to work with.

Noticed that your Informational Version appear to have an invalid date variable. Perhaps you are missing a trailing ')'?

ghost commented 7 years ago

Published a fix in version 2.0.30

Please try it out and let me know how it works for you

bencat86 commented 7 years ago

Great, it builds correctly now. Thanks for fixing so quickly!

ghost commented 7 years ago

Glad to help and thank you for your input. It led to many improvements.