WPP cpp.tmh file has size zero after moigrating driver project from VS2017 to VS2022

I run into strange problem, when after moving Driver (KMDF, filter driver) project from VS2017 to VS2022 xxx.cpp.tmh files are generated, but has size zero. :frowning:

I tried to compare vcxproj, bot I don’t find the difference in WPP setions.

Where problem may be?

Thanks for help & Regards,
Michael Grabelkovsky.

I found the problem.
Instead of
#include “DeviceFilter.cpp.tmh”
I wrote
#include “DeviceFilter.tmh”
And compilation is OK!?!

What is interesting:

  1. Both files are generated. But DeviceFilter.cpp.tmh has size zero. On VS2017 compiler including “DeviceFilter.cpp.tmh” worked for me.
  2. I have kernel static lib which is compiled with Platform Toolset WindowsKernelModeDriver10.0. And for it tmh is generated as usual XXX.cpp.tmh.

I really don’t understand what happened. and would like any comments from experts. :slight_smile:

I have other driver which I will need shift on VS2022 and I will check on it too…

My TMH files have always been Foo.TMH, so not sure where the other ones are coming from…Are these “clean” project files (i.e. not upgraded)?

1 Like

It was upgraded project.
But! I build project from template and found that it reference on tmh without “cpp”:
#include “DeviceFilter.tmh”

I repeat this ‘trick’, deleted “cpp” in my project and it was success!
It’s very strange, but works stable.
And … does not work for one other driver which I try to move on VS2022 right now… :(((

Scott,
I found and fixed the problem.
There is exist dependens from order inside the Property Page → C/C++ → Additional Include Directories list!

I moved directory where TMHs are generated in the 1st place in it and it helps!?!
Currently TMHs (without “.cpp” in the name!) are generated normally.
Don’t ask me the reason for!
By the way, inside VS2017 was not so, this dir was in the middle of the list and it works (with #include “DeviceFilter.cpp.tmh” !)

I’d very like, if somebody from experts describe the reasons for this problem.
Probably it is documented inside MSDN?
Or it’s new bug Microsoft? :frowning:

My experience is that a cleanly generated vcxproj will generate .TMH files in $(IntDir) and there’s no need to mess with the include directories.

Definitely recommend taking this time to just generate new project files and not bother with the upgrade process. It’s a PITA, but also a good opportunity to revisit the build and do any cleanup. Better to spend time on that than fighting with bugginess in the upgrade process.