Skip to content
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

Avoid inserting version if the attribute is not found #11

Open
Geekays opened this issue Oct 15, 2018 · 4 comments
Open

Avoid inserting version if the attribute is not found #11

Geekays opened this issue Oct 15, 2018 · 4 comments

Comments

@Geekays
Copy link

Geekays commented Oct 15, 2018

For some of the projects that I build occasionally have an additional file AssemblyInfoCommon.cs with the version number stuff. So, I have to run this task for AssemblyInfo*.cs files. However, this task inserts the version attributes to the files if it does not contain one. This causes duplicate entries and builds to fail.

Is there a way to avoid inserting in case the file does not have one?

@Scordo
Copy link
Owner

Scordo commented Oct 17, 2018

Hi,

if I do understand you correctly AssemblyInfoCommon.cs does not contain version attributes and no version attributes should be placed in this file?!

So why do you include them in the filter? If you dont want them to be processed just choose a filter which does not include them like: AssemblyInfo.cs (which only Includes AssemblyInfo.cs but not AssemblyInfoCommon.cs)

If I got you wrong please help me better understand your problem.

Regards,
Jens

@Geekays
Copy link
Author

Geekays commented Oct 17, 2018

Sorry, seems there is little confusion.

I am using the task to update AssemblyInfo.cs as well as AssemblyInfoCommon.cs as in some projects, the version attribute is in assemblyinfo.cs file. Whereas in some others, the version attribute is present in the assemblyinfocommon.cs file.

This works good for the projects (part of the source code) where the version is set in the AssmblyInfo.cs file only and the AssemblyInfoCommon.cs file is non-existent.

However, when the task runs on the code sections where we do have the version attribute in the AssemblyInfoCommon.cs and not in the AssemblyInfo.cs files, I see the challenge. This task updates the version in the AssemblyInfoCommon.cs file correctly but also inserts the Version Info in the AssemblyInfo.cs file there.

This causes the build to fail as it gets duplicate version tags.

So, if there could be a setting that says that "Don't insert version tag if the attribute is not available" then it will be helpful.

Hope, I could put the ask properly.

@Scordo
Copy link
Owner

Scordo commented Oct 17, 2018

Ok. Now I understand. This is currently not possible. As a workaround you could maybe add the task multiple times but with different path-filters. But this isn't nice. I'll have a look at supporting this scenario - But it will take a good amount of time, because I'm on vacation for the next 3 weeks.

@Geekays
Copy link
Author

Geekays commented Oct 18, 2018

Great! Have a good vacation and enjoy.

I shall await the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants