-
-
Notifications
You must be signed in to change notification settings - Fork 726
-
-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModifyAssemblyInfo Add new method to retain existing assemblyinfo data #1027
Comments
This would be useful. At the very least have AssemblyInfoParser return AssemblyInfoSettings. |
As you can have multiple files with "assembly attributes" in a project I think the best solution/practice would be to have one file for auto generated code and one for manually maintained code. |
No, the best solution would be to be able to modify a single file instead of having to change several hundred projects in order to link to a new file. |
That's why I think having one shared file for all projects is the best middle ground. |
Its a significant effort to convert a solution or in my case many different solutions to use the shared single assemblyinfo.cs approach. I'd like to see a good solution to updating the FileVersion and AssemblyVersion attributes without touching anything else in an existing file. Is there a best practice around this today or do I just need to read each file and re-write them doing pattern matching and string replacement? |
If you only want to touch certain attributes I would recommend having those in one file and the attributes you manually edit in a separate file. Also worth noting with new 2017 project format you can set most of these properties via msbuild properties and keep the rest / default values in the csproj. |
I forgot about this issue but got remainded today while i tried to fix a strange bug in my system, long story short it was cused by a custom attribute that i have in my AssemblyInfo.cs file that the ioc system im using where looking for however like before the methods removed them took me a day of debugging to figure out way dependencies dide not get registered xD I still stand for what i said before i need to use this attribute and am not intressted in more complexity for someting that should work out of the box. Also to note i have updated Cake to latest version 0.34.1 just to test out if this issue still existed from 0.22.0 Also ParseAssemblyInfo return type AssemblyInfoParseResult dont even have a CustomAttributes property. |
Im looking at how things work and ParseAssemblyInfo is using regex matches for everyting after playing around with it i looked at the AssemblyInfoCreator anyway if anyone wants to try and make anyting work here is the fork: https://github.com/robgha01/cake I made a test Should_Read_CustomAttributes in AssemblyInfoParserTests.cs |
As handling all corner cases of C# would take some effort perhaps it could be that using Roslyn would be better than Regex. As this would be a decent amount of refactoring I personally believe best way would be to create an addin first as a PoC and once fully backed it could potentially be something we could lift in with lower risk after it's battle tested Microsoft docs has some decent documentation on starting with Roslyn |
@devlead I have started a PoC repo here https://github.com/robgha01/Cake.AssemblyInfo for now i can get the attributes using roslyn but there constructor info is empty xD For now i have used this example here: https://stackoverflow.com/questions/57065238/getting-assembly-attributes-with-roslyn Also im a total beginer when it comes to roslyn the main goal for now is try to actually get valid data out. Edit: also found this https://joshvarty.com/learn-roslyn-now/ |
I want to modify an existing AssemblyInfo using the CreateAssemblyInfo it deletes all other info and no option exist to retain the values also ParseAssemblyInfo result can not parse directly to AssemblyInfoSettings for esey use,
I think it would be better to add one more function to the aliases named ex
ModifyAssemblyInfo or EditAssemblyInfo wich take in the same call parameters as CreateAssemblyInfo but only modifies and keeps the info that is not modified ?
The text was updated successfully, but these errors were encountered: