- 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".
- Add
propsandtargetsimports in thenfproj:- Add the following
Importafter the lastpropsImportnode (somewhere at the top of the project node).Note: Replace [PackageVersion] with the appropriate version.<Import Project="..\packages\amaletski.nanoFramework.MSBuildTasks.[PackageVersion]\build\netnano1.0\amaletski.nanoFramework.MSBuildTasks.props" />
- Add the following
Importafter the lasttargetsImportnode (somewhere at the bottom of the project node).Note: Replace [PackageVersion] with the appropriate version.<Import Project="..\packages\amaletski.nanoFramework.MSBuildTasks.[PackageVersion]\build\netnano1.0\amaletski.nanoFramework.MSBuildTasks.targets" />
- 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.
Why should I do this?
Without these imports, the package will not work. There are likely some issues with the nanoFramework project system because, according to this Microsoft Docs page, these imports should be managed automatically.
To use this feature, nfproj should be updated.
Files that should be included in the embedded resources can be configured through user-defined ResourcesSource elements. All files that match will be embedded as binary resources.
Note
If there are no ResourcesSource elements in the nfproj, the resx file will not be generated, and resources will not be embedded.
Tip
Multiple ResourcesSource elements can be specified in the same nfproj. All matching files will be embedded into the same resources file.
| Attribute | Required | Description |
|---|---|---|
Include |
Required | Relative or absolute path to the folder with files to include |
RegexFilter |
Optional | Regular expression to filter files within the Include directory. |
SearchPattern |
Optional | Search pattern to filter files within the Include directory. |
Warning
Do not specify RegexFilter and SearchPattern in the same ResourcesSource as it will cause a validation error.
Optionally, the name of the generated resx file can be overridden through the GeneratedResxFileName custom property. Default value: Resources.resx.
Note
The generated resx file will be deleted on project/solution clean.
Examples:
<PropertyGroup>
<GeneratedResxFileName>CustomFileName.resx</GeneratedResxFileName>
</PropertyGroup><ItemGroup>
<ResourcesSource Include="Settings">
<SearchPattern>*.json</SearchPattern>
</ResourcesSource>
<ResourcesSource Include="..\spa\dist" />
</ItemGroup>