Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Build with .NET binding fails: missing metahost.h #35

Closed
leeprtc opened this issue Sep 30, 2016 · 3 comments
Closed

Build with .NET binding fails: missing metahost.h #35

leeprtc opened this issue Sep 30, 2016 · 3 comments

Comments

@leeprtc
Copy link

leeprtc commented Sep 30, 2016

I followed the directions in Getting Started document. But when I ran"build.cmd --enable-dotnet-binding", I'm getting errors. The reason is it cannot find metahost.h. This affects dotnet, dotnet_hl, dotnet_hl_static, and dotnet_static projects.

Looking through my system, metahost.h can be found in the NETFXSDK include directory. Checking the project properties for dotnet* projects, I don't see the NETFXSDK include directory being specified as an additional include directory.

Is there a bug in the generation of the dotnet* project files?

Thanks,

Peter.

@aribeironovaes
Copy link
Contributor

Hi @leeprtc ,

Thanks for using our SDK. Yes, we are aware of this problem and we are working to find a fix and also document the root cause.

Apparently this happens because when you have 8.1 and 10 SDK CMAKE defaults to Windows 10 SDK, which doesn't build for the current .NET Binding. So, in order to mitigate that while we work on a fix you can:
1-Open the Visual Studio Project and, on the project it's failing (dotnet_hl.dll and all the dotnet host project), change from the Windows 10 SDK to Windows 8.1 SDK). Build again on visual studio.

Keep in mind that this will surface again if you run again the build.cmd.

Let us know if this doesn't fix your problem.

Thanks a lot,

Angelo Ribeiro.

@leeprtc
Copy link
Author

leeprtc commented Oct 3, 2016

Changing to Windows 8.1 SDK fixed the errors.

Thanks!

obsoleted added a commit to obsoleted/azure-iot-gateway-sdk that referenced this issue Dec 2, 2016
- Workaround for Issue Azure#35
@damonbarry damonbarry changed the title Problems building with enable-dotnet-binding Build with .NET binding fails: missing metahost.h Dec 8, 2016
@damonbarry
Copy link
Member

Fixed with commit 00ab31f.

Metahost.h is available in several locations (and they're all the same for our purposes), e.g. on my dev box:

 C:\Program Files (x86)\Windows Kits\8.1\Include\um\metahost.h
 C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\Include\um\metahost.h
 C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um\metahost.h

Metahost.h is NOT available in the Windows 10 SDK for whatever reason. If you're targeting this SDK, I think it is expected that you'll pull it from the NETFX SDK instead. What's weird is that the NETFX SDK include path IS part of the INCLUDE env var, and INCLUDE should be searched by VC build, but apparently that's not happening here.

So the fix is to add %NETFXSDKDir%Include\um to the include directories in the dotnet and dotnet_static projects. The NETFXSDKDir environment variable is set in the VS Developer Command Prompt (and the MSBuild Command Prompt).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants