Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper VS_WINRT_REFERENCES for Microsoft.Advertising.winmd? #17

Closed
TedHoward opened this issue Mar 2, 2016 · 15 comments
Closed

Proper VS_WINRT_REFERENCES for Microsoft.Advertising.winmd? #17

TedHoward opened this issue Mar 2, 2016 · 15 comments

Comments

@TedHoward
Copy link

I'm trying to add the MSFT ad mediation SDK to our game. I can't seem to figure out the correct way to set VS_WINRT_REFERENCES. Or maybe I found a bug/limitation. If I manually add a reference to "Ad Mediator SDK for Windows 8.1 XAML" Version=1.0 everything works.

I've tried setting it to the .winmd file, full path or partial path. I've tried setting it to the per-architecture .dll file. The closest I've ever gotten was it compiled but upon running there was a ClassNotRegisteredException trying to use the sdk classes.

Anyone have any good thoughts?

@TedHoward
Copy link
Author

Hmmm... I guess I try again and see if Process Monitor can tell me where msbuild is looking to find the references.

@khouzam
Copy link

khouzam commented Mar 9, 2016

Sorry, missed the issue. Will try to look at this this week.

@johanlindfors
Copy link

Any news on this issue? I'm having similar issues (or at least I can't figure out how to appropriately add a reference to a .winmd file in an UWP app?

@TedHoward
Copy link
Author

By coincidence, I was going to look at this again today or tomorrow. As I said, step #1 is reverse-engineering msbuild/VS using Process Monitor to see how it finds the actual dll's.

@khouzam
Copy link

khouzam commented Apr 8, 2016

If I look at the project when adding a reference to the SDK, it gets an SDKReference defined, not just a Reference.

It should be easy to add a new VS_SDKREFERENCE variable to CMake to allow for SDKs to be specified. I had added that support for Windows 10, but specifically for the IOT, Mobile and Desktop extensions. Making it generic should be simple enough.

@khouzam
Copy link

khouzam commented Apr 8, 2016

Sorry for the delay, I've added support for generic SDKReferences.

@d7ec8f90c9d42eec42e2b3f6305329415881740c

Simply add a Target property to the SDK like this:
set_property(TARGET ${EXE_NAME} PROPERTY VS_SDK_REFERENCES "Microsoft.AdMediatorWindows81, Version=1.0")

@TedHoward
Copy link
Author

Excellent support as usual.

But now I just can't get cmake 3.5 to give me a winrt/phone8.1 project.

  1. "-G Visual Studio 14 2015 -T v140"
    Only appears to work for Win10 projects and we're not ready to cut out all Win8.1 users. That's like asking people to not be our customers.
  2. "-G Visual Studio 12 2013 -T v120" or without -T
    Close but I get this error. Never had a problem with cmake before 3.5. And I can find nothing called "Windows Desktop SDK" to install so I'm stumped for now.
    "A Windows Store component with CMake requires both the Windows Desktop SDK
    as well as the Windows Store '8.1' SDK. Please make sure that you have
    both installed"

@johanlindfors
Copy link

If I understand this solution correctly, this requires the SDK to be pre-installed on the computer on which the solution is build. From my perspective (building on different remote servers) it causes unwanted configurations on these machines. Especially if the list continues to grow regarding which SDK's is needed in a configuration.

@TedHoward
Copy link
Author

Merged this fix over and I have a Win8.1 project building.
https://cmake.org/Bug/view.php?id=15986#c40534

But I can't get a WinPhone8.1 project building. Maybe CMAKE_VS_MSBUILD_COMMAND needs to be set based on toolset, not VS version (GetToolsVersion()). But then it tries to use msbuild files from the toolset version, which I don't have as I don't have VS2013 installed.

@khouzam
Copy link

khouzam commented Apr 11, 2016

I was not aware of the -T v120/-T v140 issues. I have never tried specifying the toolset, but have always set the CMAKE_SYSTEM_VERSION and CMAKE_SYSTEM_NAME. I'll take a look at what the issue is.

As for the Ad Mediation SDK, in order not to use the SDK_REFERENCES, then as Ted mentions, the references of the SDK would need to be reverse engineered for the assemblies to be part of the build and referenced directly by the project.

I'm at F8 until Thursday, so it might take a little more time.

@TedHoward
Copy link
Author

My next attempt will be to merge the VS_SDK_REFERENCES feature into the 3.4 codebase. I'll report back when I get around to that.

@TedHoward
Copy link
Author

That worked! Thanks.

I changed "this->GeneratorTarget->GetProperty" to "this->Target->GetProperty" but maybe I misunderstood where I should be setting the SDK reference. set_target_properties() made sense to me.

fyi, The MSFT ads sdk for Win8.1 is "Microsoft.AdMediatorWindows81, Version=1.0" for but WinPhone8.1 is "Microsoft.AdMediator81, Version=1.0". Bit of a surprise.

@johanlindfors
Copy link

Any idea if this (VS_SDK_REFERENCES) will be merged into the official CMAKE?

@khouzam
Copy link

khouzam commented Jun 10, 2016

Sorry, I've been working on some other issues, I'll try to update the code and issue a patch to the official release.

@khouzam
Copy link

khouzam commented Jun 20, 2016

They are now in their master branch.

@khouzam khouzam closed this as completed Jun 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants