Fitgen.exe fails to build Dynastream.Fit.Portable.dll

I am trying to build the C# SDK dll's with custom messages, this has not been working so I've had the source files included in my project instead.

I would like to just include the .dll instead.

I've tried building with fitgen on a freshly downloaded version of the SDK (unzip and run fitgen) and it will only build the fit.dll:

PS ~\FitSDKRelease_21.101.00> .\fitgen -cs
FIT Code Generator - Protocol 2.00 Profile 21.101Release
SDK Version: production/release/21.101.00-0-gceb92d5
Parsing existing config.csv...
Writing new config.csv...
Generating C# code...
Building C# SDK...
Fit.dll generation status: Success
Fit.dll generation status: Failure

I have the following C# SDK's installed:

.NET Core SDK 3.1.426

.NET Core SDK 6.0.309

.NET Core SDK 7.0.102

When I follow the instructions to add my custom message via messages.csv, neither of the dll's will build.

Could someone please advise how to rectify this.

Thanks.

  • The problem is probably not with the generated code, you mentioned including the code in your project and I assume that works. The issue might be that the project files were created with a version of Visual Studio that is older than the version of Visual Studio that you are using. You may be using a newer version of Visual Studio or you may not have all of the dependancies installed. The project file is spec'ing a very old version of the Dotnet framework (1.0 or 2.0) and updating the project to a version that you have installed may resolve the issue. Try building the dlls using Visual Studio (not VS Code). Dynastream.Fit.Portable.dll is built from the path\tosdk\cs\Examples\FitPortable\FitPortable.csproj project. There is a solution file located a few directories above at path\tosdk\cs\Examples\Example.sln. I would start by opening the solution file and doing a rebuild all. If you get a prompt to update the project files than you probably should. If there are still errors, then you should be able to see what they are. You can also create a new project with the version of VS that you are using and add all of the generated files to it.

  • Thanks Ben. This was very helpful.

    Indeed it has been working fine just including the dynastream folder in my project, but I wanted to swap to using the precompiled dll.

    Copying the contents of the Dynastream folder into a new class library and building the dll from there has worked fine.

    I think it would be nice if the documentation outlined exactly what is required from a dependencies standpoint to have fitgen build it front to back, rather than only do the code generation and then have to copy things around/build manually, or at least explain how to do the steps you've outlined.

    Really appreciate the help, I was able to get up and running in 10 minutes; thanks again for the clear explanation.

  • The code itself does not have dependancies other than a C# "compiler". The C# SDK is written in vanilla C# and compiles using any variant of the .NET Framework, NET Core, etc. The issue you are having is with the project files and for two different reasons.

    Out of the box only one of the two dlls compiled for you. The portable dll probably didn't compile because the project file is configured to target .NET Framework 4.5 and ASP .NET Core 1.0, and you probably don't have those versions of the frameworks installed and can probably only get them by installing Visual Studio 2015 or 2017.  But the targets can be changed in the project settings to match the versions that you have installed.

    After you used FitGen to add your custom messages to the SDK neither dll compiled. This is because the source files for your custom message are not included in the projects. FitGen does not create new Visual Studio project files, so those files are not included when building the dll. But there are files that are part of the project that are dependent on your custom messages. To fix this, you can either add the files for your custom messages, and/or types, to the existing projects, create your own project, or include the source files in your project. 

    At the moment we do not plan to update any of the project files. We don't know what version of VS people are using, so we purposely stay a few versions behind. It is easier to upgrade the project files than it is to downgrade them.