CastelloBranco.LocatorGenerator 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package CastelloBranco.LocatorGenerator --version 1.0.4
                    
NuGet\Install-Package CastelloBranco.LocatorGenerator -Version 1.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CastelloBranco.LocatorGenerator" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CastelloBranco.LocatorGenerator" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="CastelloBranco.LocatorGenerator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CastelloBranco.LocatorGenerator --version 1.0.4
                    
#r "nuget: CastelloBranco.LocatorGenerator, 1.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=CastelloBranco.LocatorGenerator&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=CastelloBranco.LocatorGenerator&version=1.0.4
                    
Install as a Cake Tool

#CastelloBranco.LocatorGenerator

CastelloBranco.LocatorGenerator � uma ferramenta para gerar automaticamente o c�digo necess�rio para localizar e instanciar ViewModels marcados com um atributo especial em projetos WPF, Avalonia, WinUI, UWP e UNO.

#Uso:

[RegisterOnLocatorAttribute] � usado para marcar classes ViewModel para inclus�o no localizador.

Gerador de C�digo: Uma ferramenta que analisa projetos em busca de classes com o atributo RegisterOnLocatorAttribute e gera um arquivo ViewModelLocator.g.cs para resolver e injetar depend�ncias automaticamente usando a biblioteca CommunityToolkit.Mvvm. Estrutura do Projeto

LocatorGenerator.exe: O gerador que carrega e analisa um projeto MSBuild fornecido pelo usu�rio, identifica classes decoradas com [RegisterOnLocatorAttribute] e gera um arquivo ViewModelLocator.g.cs que exp�e cada ViewModel identificado como uma propriedade est�tica, permitindo a inje��o de depend�ncia autom�tica.

  1. Build: Compile o projeto LocatorGeneratorTool para obter o executavel

  2. NuGet Package: Adicione o pacote CastelloBranco.LocatorGenerator ao projeto que utilizar� o localizador gerado.

  3. No projeto que utilizara o gerador adicione uma tarefa MSBUILD chamando o executavel onde:

    execute LocatorGeneratorTool.exe [Caminho da Solu��o] [Arquivo de Projeto] [Diret�rio de Sa�da]


<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
  <Exec Command="C:\LocatorGenerator\LocatorGenerator.exe $(ProjectDir) $(ProjectName).csproj Generated" />
</Target>

#Sa�da:

Ap�s a execu��o, um arquivo ViewModelLocator.g.cs ser� gerado no diret�rio especificado (neste exemplo, Generated), contendo propriedades est�ticas para cada ViewModel detectado.

O arquivo ViewModelLocator.g.cs gerado ter� uma estrutura semelhante a:


public partial class ViewModelLocator 
{
    public ViewModelLocator() { }

    public static namespace.ViewModel1? ViewModel1 => Ioc.Default.GetRequiredService<namespace.ViewModel1>(); 
    public static namespace.ViewModel2? ViewModel2 => Ioc.Default.GetRequiredService<namespace.ViewModel2>(); 
    // etc.
}

Para registrar uma classe como um ViewModel localiz�vel:


[RegisterOnLocator]
public class MeuViewModel { }

#Licen�a:

MIT

#Contribui��o:

Contribui��es s�o bem-vindas! Siga o fluxo de pull requests e confira nossa pol�tica de contribui��es.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

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
3.0.2 115 3/2/2025
3.0.1 103 3/2/2025
3.0.0 110 3/2/2025
2.2.55 105 3/1/2025
2.2.52 116 3/1/2025
2.2.51 100 3/1/2025
2.2.6 103 3/1/2025
2.2.5 109 3/1/2025
2.2.3 95 3/1/2025
2.2.1 101 3/1/2025
2.2.0 105 3/1/2025
2.1.9 104 3/1/2025
2.1.8 114 2/27/2025
2.1.7 117 2/27/2025
2.1.6 104 2/22/2025
2.1.5 100 2/14/2025
2.1.4 109 2/13/2025
2.1.3 113 2/11/2025
2.1.2 99 2/11/2025
2.1.1 121 2/11/2025
2.1.0 103 2/11/2025
2.0.9 114 2/11/2025
1.0.4 115 11/12/2024
1.0.0 106 2/11/2025