BT.TagAnalyser
1.2.0
dotnet add package BT.TagAnalyser --version 1.2.0
NuGet\Install-Package BT.TagAnalyser -Version 1.2.0
<PackageReference Include="BT.TagAnalyser" Version="1.2.0" />
<PackageVersion Include="BT.TagAnalyser" Version="1.2.0" />
<PackageReference Include="BT.TagAnalyser" />
paket add BT.TagAnalyser --version 1.2.0
#r "nuget: BT.TagAnalyser, 1.2.0"
#:package BT.TagAnalyser@1.2.0
#addin nuget:?package=BT.TagAnalyser&version=1.2.0
#tool nuget:?package=BT.TagAnalyser&version=1.2.0
Description
<small>This is a MSBuild extension to provide an interface for build environment(s) to check Tags for each file
to validate their values based on DevOps project Tags.
Specifically designed for Relay UK project.
</small><br />
Installation
dotnet add package BT.TagAnalyser<br /> <small>or for any specific version</small><br /> dotnet add package BT.TagAnalyser --version 1.0.7<br /> <small>or add as a Nuget package to your project from Nuget Manager</small><br />
Parameters
Files: The list of files to be scanned. <br />
<ItemGroup>
<AllProjectFiles Include="$(MSBuildProjectDirectory)\**\*.*" />
</ItemGroup>
<FileScannerTask Files="@(AllProjectFiles)" TargetExtensions=".cs;.txt;.md" />
or
<FileScannerTask Files="@(Compile)" TargetExtensions=".cs;.txt;.md" />
TargetExtensions: Semicolon-separated list of file extensions to scan (e.g., ".cs;.xaml"). Defaults to ".cs;.xaml" if not provided. <br />
<FileScannerTask Files="@(Compile)" TargetExtensions=".cs;.txt;.md;xaml;.xml;.json;" />
IgnoreNoFileContent: Ignores files with no content. Default is false. <br />
<FileScannerTask Files="@(Compile)" TargetExtensions=".cs;.txt;.md" IgnoreNoFileContent="true" />
IgnoreNoTagsFound: Ignores files where no tags are found. Default is false. <br />
<FileScannerTask Files="@(Compile)" TargetExtensions=".cs;.txt;.md" IgnoreNoTagsFound="true" />
LogTagsFound: Logs information about found tags. Default is false. <br />
<FileScannerTask Files="@(Compile)" TargetExtensions=".cs;.txt;.md" LogTagsFound="true" />
IgnoreInValidTags: Ignores files with invalid tags. Default is false. <br />
<FileScannerTask Files="@(Compile)" TargetExtensions=".cs;.txt;.md" IgnoreInValidTags="true" />
PreviewDevOpsTags: Prints the DevOps tags obtained from DevOps. Default is false. <br />
<FileScannerTask Files="@(Compile)" TargetExtensions=".cs;.txt;.md" PreviewDevOpsTags="true" />
<small>If the parameter values are not given, default values will be used</small><br />
Usage
Usage is defined in the .csproj file of your project. You need to register the custom task and create a target that executes before the project builds.
Below is an example of how to set this up in your
As a Nuget Package
Install Nuget using Nuget Manager or dotnet CLI, then modify it's PackageReference to add GeneratePathProperty="true".
This will generate a property that points to the path of the installed package, which can be used in the UsingTask to reference the DLL without hardcoding the path.
<ItemGroup>
<PackageReference Include="BT.TagAnalyser" Version="1.1.0" GeneratePathProperty="true" />
</ItemGroup>
Then usage is
<UsingTask TaskName="TagAnalyser.FileScannerTask"
AssemblyFile="$(PkgBT_TagAnalyser)\lib\net10.0\TagAnalyser.dll"
Runtime="NET"
TaskFactory="TaskHostFactory" />
As a Direct DLL Reference
TaskFactory sorts out locking problem of the analyser dll but it needs to be told Runtime=NET to run it in modern .net .
Another way of sorting this problem is to killing MSBuild processes because vstudio keeping it alive to re-use them , command is (taskkill /F /IM MSBuild.exe)
<UsingTask TaskName="TagAnalyser.FileScannerTask"
AssemblyFile="C:\Users\617563066\Documents\Repos\TagAnalyser\TagAnalyser\bin\Debug\net10.0\TagAnalyser.dll"
Runtime="NET"
TaskFactory="TaskHostFactory" />
As a Direct DLL Reference with Custom Path
<UsingTask TaskName="TagAnalyser.FileScannerTask"
AssemblyFile="$(UserProfile)\.nuget\packages\bt.taganalyser\1.0.8\lib\net10.0\TagAnalyser.dll"
Runtime="NET"
TaskFactory="TaskHostFactory" />
All the above ways will work, but the first one is recommended as it is more flexible and does not require hardcoding paths,
making it easier to maintain and share across different environments. Finalised usage example is as below, you can modify the parameters of the FileScannerTask as needed.
<ItemGroup>
<PackageReference Include="BT.TagAnalyser" Version="1.1.0" GeneratePathProperty="true" />
</ItemGroup>
<UsingTask TaskName="TagAnalyser.FileScannerTask"
AssemblyFile="$(PkgBT_TagAnalyser)\lib\net10.0\TagAnalyser.dll"
Runtime="NET"
TaskFactory="TaskHostFactory" />
<Target Name="ExecuteMyCustomAction" BeforeTargets="BeforeCompile">
<ItemGroup>
<AllProjectFiles Include="$(MSBuildProjectDirectory)\**\*.*" />
</ItemGroup>
<FileScannerTask Files="@(AllProjectFiles)"
TargetExtensions=".cs;.txt;.md"
IgnoreNoFileContent="true" IgnoreNoTagsFound="false" LogTagsFound="false" IgnoreInValidTags="false" PreviewDevOpsTags="true" />
</Target>
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- System.CommandLine (>= 2.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|
This version compatible with .Net 10.0