- 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
Importnode (somewhere at the top of the project node).Note: Replace [PackageVersion] with the appropriate version.<Import Project="..\packages\amaletski.nanoFramework.SourceGenerators.[PackageVersion]\build\netnano1.0\amaletski.nanoFramework.SourceGenerators.props" />
- Add the following
ItemGroupwithAnalyzernode:Note: Replace [PackageVersion] with the appropriate version.<ItemGroup> <Analyzer Include="..\packages\amaletski.nanoFramework.SourceGenerators.[PackageVersion]\analyzers\dotnet\cs\*.dll" /> </ItemGroup>
- Press
Ctrl+Sto save changes.
- Add the following
- 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.
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>