Skip to content

AlexanderMaleckij/nanoFramework.SourceGenerators

Repository files navigation

License NuGet

nanoFramework.SourceGenerators

Package Installation (Visual Studio)

  • Install the NuGet package as usual.
  • Unload the project:
    • Right-click the project in the "Solution Explorer" window.
    • Select "Unload Project".
  • Open the project file:
    • Right-click the unloaded project in the "Solution Explorer" window.
    • Select "Edit Project File".
  • Edit the project file:
    • Add the following Import node (somewhere at the top of the project node).
      <Import Project="..\packages\amaletski.nanoFramework.SourceGenerators.[PackageVersion]\build\netnano1.0\amaletski.nanoFramework.SourceGenerators.props" />
      Note: Replace [PackageVersion] with the appropriate version.
    • Add the following ItemGroup with Analyzer node:
        <ItemGroup>
          <Analyzer Include="..\packages\amaletski.nanoFramework.SourceGenerators.[PackageVersion]\analyzers\dotnet\cs\*.dll" />
        </ItemGroup>
      Note: Replace [PackageVersion] with the appropriate version.
    • Press Ctrl+S to save changes.
  • Reload the project:
    • Right click the unloaded project in the "Solution Explorer" window.
    • Select "Reload Project".

Important

Make sure to update the imports after updating the NuGet package version.

Use Cases

Generating the ResourcesMetadataProvider class

To utilize this feature, an AdditionalFiles item node must be added to the nfproj file. This node can include attributes to specify which metadata properties and metadata provider methods should be generated. Below is an example that includes all applicable attributes:

<ItemGroup>
  <AdditionalFiles Include="Resources.resx"
    ResourceMetadata_IncludeName="true"
    ResourceMetadata_IncludeUriPath="true"
    ResourceMetadata_IncludeSize="true"
    ResourceMetadata_IncludeContentType="true"
    ResourceMetadata_IncludeContentEncoding="true"
    ResourcesMetadataProvider_Generate="true"
    ResourcesMetadataProvider_GenerateFindByName="true"
    ResourcesMetadataProvider_GenerateFindByUriPath="true" />
</ItemGroup>

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages