hvanbakel / CsprojToVs2017

Tooling for converting pre 2017 project to the new Visual Studio 2017 format.
MIT License
1.08k stars 120 forks source link

In cases where AssemblyInfo is being preserved and there are multiple… #257

Closed jlegan closed 5 years ago

jlegan commented 5 years ago

… AssemblyInfo files present (very common in GitVersion implementations where there is a single common AssemblyInfo file containing version info and an AssemblyInfo file containing library specific details), AssemblyDetails will be null (multiple files not currently supported) but there is no null check in NuGetPackageTransformation. Added null propagation on the assemblyAttributes object. If time allows I will add support for multiple assemblyinfo files but at a minimum this fixes the null reference exception when assembly info details are being preserved.

andrew-boyarshin commented 5 years ago

@jlegan regarding your wish to improve support for shared (common, global) assemblyinfo files. They are already supported (I regularly test the project on ConfuserEx and Dopamine, both have shared assemblyinfo files). The degree of that support however is minimal: preserve all assemblyinfo files, do not read information from them. I introduced such behavior back in #139, to not to introduce errors during conversion. There aren't much things that can be done to improve the situation (or they are quite complicated).

Note, that these require making a lot of assumptions about the structure of the project. E.g. in ConfuserEx the shared assemblyinfo file might not exist at the time of conversion (it is being generated during build process by one of the projects being built).

Thanks you for your contribution, I can't believe such bug existed and wasn't noticed before.