This repo contains .NET nanoFramework metadata processor tool. It's a console app that performs various tasks when running a build of a C# project, like parsing the PE file generated by Roslyn, generating the PDBX files, generate the stubs for native code. Is part of .NET nanoFramework toolbox, along with other various tools that are required in .NET nanoFramework development, usage or repository management.
Version 2.0 is a C# application adapted from the original work of Oleg Rakhmatulin. Version 1.0 was a Visual C++ application adapted from .NETMF toolbox.
The metadata processor is available in two packages.
The main use of the metadata processor is packaged as a MSBuild task: nanoFramework.Tools.MetadataProcessor.MsBuildTask. The task is well integrated into the .NET nanoFramework build system and is distributed as part of the VS extensions. Almost all use cases can be addressed by the build system as it is, or by setting build variables for, e.g., additional logging.
There are few use cases where the build task cannot be used. E.g., in software that generates source code at runtime, compiles the code via Roslyn, executes it on the virtual device, and uses the output for further processing. The metadata processor is required as a companion to Roslyn to convert the generated .NET assemblies to .NET nanoFramework .pe assemblies. The second package, nanoFramework.Tools.MetadataProcessor.CLI, contains a CLI version of the tool for this purpose. It is packaged as content: if added to a project, the tool will be distributed with the results of that project. If the package is added to a non-SDK-style project (e.g., .NET Framework project), make sure to set the Copy to Output Directory property for the files, as the package manager does not automatically do that. The code in the project should run the CLI with arguments -loadhints, -parse and -compile (in that order!) to create the .pe assembly.
After cloning the repository, instantiate the submodules with:
git submodule update --init --recursive
After which the NuGet packages in both the main solution and the mscorelib solution included within a submodule have to be restored. These have to be restored individually.
When adding a project to the solution the following points have to be kept in mind for configuring the project and solution:
- nanoFramework projects (.nfproj) have to be build in
AnyCPU
configuration. - DLLs for msbuild tasks have to be build in
x64
because Visual Studio uses this architecture since VS2022. - Any nanoFramework projects (.nfproj) that are required for Unit Tests have to have their build configuration changed so they don't build. Building those has to be added to the pre-build event of the Unit Test project that will be using it. See the prebuild event for the MetadataProcessor.Tests project. When adding nanoFramework projects to the pre-build event it is important to add the
-nr=False
flag[1].
- This flag disables "nodeReuse", this is needed as a custom MsBuildTask is used which also gets rebuilt. "NodeReuse" keeps instances of MsBuild running which interferes with the rebuilding of the custom MsBuildTask.
To provide feedback, report issues and finding out how to contribute please refer to the Home repo.
Join our Discord community here.
The list of contributors to this project can be found at CONTRIBUTORS.
The nanoFramework metadata processor tool is licensed under the MIT license.
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behaviour in our community. For more information see the .NET Foundation Code of Conduct.
This project is supported by the .NET Foundation.