colindembovsky / cols-agent-tasks

Colin's ALM Corner Custom Build Tasks
MIT License
83 stars 67 forks source link

Disable no match warnings in Version Assemblies? #67

Closed ceituna closed 7 years ago

ceituna commented 7 years ago

We've been seeing the following warnings in our build summary since we've updated to the newest version of the Version Assemblies task.

screenshot-visualstudio com

The assembly.info files in the screenshot above seem to be added by NuGet restore and since we don't use any of these dll's we'd like to be able to disable warnings for these files.

Maybe a radical solution is to just be able to disable these warnings? Or is there a way for me to fix this with a specific file pattern?

Here's an overview of the settings we're using:

screenshot-visualstudio com2

20-08-2017 Update: Added a pull request with a possible "fix".

colindembovsky commented 7 years ago

Hi @ceituna - I think a better solution is just adding a more intelligent file filter. If we have "disable warnings" then you won't get warnings when you should.

It looks like all the files in the packages folder are being picked up - that's because you're looking in **\ (which is any subdirectory from the Source directory). If you change the Source Path to a deeper directory (one that doesn't contain packages) or add an exclusion to the filter something like this: **(!packages)\*.AssemblyInfo.* (you'll have to play around to get the exact pattern - this is a minimatch expression) then you won't get "false" warnings.

It would be great if you posted your exclusion expression back here once you work it out!

ceituna commented 7 years ago

Haha, yeah, I thought that may be too extreme of a solution. I've tried out a few variations of your suggested pattern (like: *(!packages)\AssemblyInfo.) but it didn't work unfortunately. I tried a few other combinations, but since I've head barely any experience writing minimatch expressions/globs, I wasn't successful in writing one that includes the AssemblyInfo files except for the ones in the packages folder.

I did eventually write this one and it works for now: *\CompanyName.ProjectName\Properties\AssemblyInfo.*. This one includes all AssemblyInfo files which are to be found in the properties folder of one of our VS Projects which all have a name with the pattern CompanyName.ProjectName.SpecificProjectName.

TLDR: Changing the pattern helped *\CompanyName.ProjectName\Properties\AssemblyInfo.*, adding a "disable warnings" option is maybe a bad idea.

Thank you for the suggestion!

colindembovsky commented 7 years ago

Thanks @ceituna - the other option is to do this before you run the NuGet restore (so that the packages folder is empty when the task runs). You shouldn't have anything in there before the NuGet restore.