问题
I'd like to get some clarification on something that I've been confused on for awhile.
I've tried to read as much documentation (both 1st and 3rd party) on the generation of IDL and MetaData files for Runtime Components as I could, and perhaps it lies in my ability to comprehend the material, but I'm still a little (very) lost.
If I understand correctly, once a Runtime Component is compiled into a DLL, that is used to generate an IDL file which is then used in the creation of windows meta data files. In the MS sample app Chatterbox VoIP, the Runtime component project has a custom build step (PostBuildEvent) that does the following:
pushd "$(OutDir)"
WinMdIdl.exe "$(OutDir)$(RootNamespace).winmd"
MIdl.exe /env $(MidlEnv) /winrt /ns_prefix /metadata_dir "$(FrameworkSdkDir)Windows Metadata" /out "$(SolutionDir)$(ProjectName)ProxyStub" "$(OutDir)$(RootNamespace).idl"
MIdl.exe /env $(MidlEnv) /winrt /ns_prefix /metadata_dir "$(FrameworkSdkDir)Windows Metadata" /out "$(SolutionDir)$(ProjectName)ProxyStub" "$(OutDir)$(RootNamespace).OutOfProcess.idl"
"$(ProjectDir)OopServerRegistrationHelper.exe" /winmd:"$(OutDir)$(RootNamespace).winmd" /dll_name:$(TargetName) /namespace:$(RootNamespace).OutOfProcess /app_manifest:"$(SolutionDir)UI\Properties\WMAppManifest.xml" /helper_dir:"$(SolutionDir)Agents"
popd
However, in a project of my own, using a simple c++ class in a Runtime component referenced in a C# app, I never did any manual configuration for the creation/processing of IDL files. I simply added a reference in the C# project to my C++/CX Runtime Project, compiled, and it worked.
So, what is the deal here? Are the IDL and WinMD files automatically generated for every Runtime Component Project? Or am I doing something incorrectly/inefficiently by not using these IDL processing tools?
Let me know if I need to include any more information.
来源:https://stackoverflow.com/questions/18994078/generation-of-idl-and-winmd-files-for-runtime-components-on-wp8