• 0

VS Reference with exclamation mark


Question

Hello gang,

 

I found this code ( http://www.getcodesamples.com/src/5D67423E ) that returns some of the audio data so I can create visualizations with c#.  The DLL works find when included with a Windows 8 Store app, but with a desktop app (Frameworks 4.0 or 4.5) I get the yellow exclamation mark next to the Reference in the parent project.

 

Any ideas what I am doing wrong?  The MMAudioPlayer is C++, which I do no know.

Link to comment
https://www.neowin.net/forum/topic/1191993-vs-reference-with-exclamation-mark/
Share on other sites

18 answers to this question

Recommended Posts

  • 0
  On 09/12/2013 at 16:55, Eric said:

That usually means it's not a valid CLR reference. You may need to change the platform the audio player is set to build for.

 

Eric,

 

I found this article that I believe is what you are speaking about: http://msdn.microsoft.com/en-us/library/ms185328.aspx

 

Here is my current config for this new project.  MMAudioPlayer is the component that is okay if included in a Win8 Store app, which is also defined as "x86"  Since both of these are the same I feel that I am still wrong, or not getting what you are telling me.

 

Build Configuration:  http://imgur.com/VKeQk50

  • 0
  On 09/12/2013 at 17:35, Eric said:

Hmm... the config looks ok from here. I will try downloading the MMAudioPlayer later and see what I can coerce it into doing. Is it set to output CLR in the C++ config? (/clr command line option)

 

Is this the command line option you are speaking about?  (again, I appologize for my lack of C++ knowledge)

 

Settings: http://imgur.com/THuICrX

  • 0

There's a setting under the General tab for "Common Language Runtime Support" that controls it but I think you can just add the /clr to that dialog too. It should add an external reference for mscorlib.dll. It's likely already set that way if you have it working on the Windows Store side. It looks like Windows Store DLLs have different references.

  • 0
  On 09/12/2013 at 21:59, Eric said:

There's a setting under the General tab for "Common Language Runtime Support" that controls it but I think you can just add the /clr to that dialog too. It should add an external reference for mscorlib.dll. It's likely already set that way if you have it working on the Windows Store side. It looks like Windows Store DLLs have different references.

 

 

Eric,

 

Thank you very much for your time and help.  I will look for the setting, but I would also like to know if there is anywhere specific in the command line where the: /clr switch should be placed?

 

Have a great evening.

  • 0

You probably don't have matching targets for the DLL and your desktop project. You can get yellow bangs if there is a mismatch between referenced assemblies and your project. Normally it is something like .net 3.5 vs .net 4.5. In your case, I'm not exactly sure _what_ the windows Windows 8 store app target would be (but probably something different from .net 4.5). I did find this though and perhaps it will work for you:

 

http://msdn.microsoft.com/en-us/library/windows/apps/jj856306.aspx

  • 0

It can go anywhere under Command Line I believe but you can also turn it on in the General tab by changing that setting.

post-175510-0-62737000-1386683456.png

Is there any way to download the zip of that project? It tells me it hasn't been published.

EDIT: I downloaded the source files individually and dumped them into a CLR class library project and it fails to compile miserably for me.

I don't know very much at all about C++ CLR or DirectX myself. :(

  • 0
  On 10/12/2013 at 13:51, Eric said:

It can go anywhere under Command Line I believe but you can also turn it on in the General tab by changing that setting.

attachicon.gifScreenshot (8).png

Is there any way to download the zip of that project? It tells me it hasn't been published.

EDIT: I downloaded the source files individually and dumped them into a CLR class library project and it fails to compile miserably for me.

I don't know very much at all about C++ CLR or DirectX myself. :(

 

No worries Eric, neither do I.   I am unable to add anything to the command line,,, don't know why.  Nor does the "Common Language Runtime Support" option exist for me.  I am using VS 2013, and I see you have 2013.  So that could be the issue.

  • 0
  On 10/12/2013 at 15:47, Eric said:

Have you looked at NAudio? I don't think it supports Windows Store projects but you could always abstract your audio into interfaces and use different engines for desktop/Metro.

 

I did take a brief look at NAudio, but had to use the MMAudio because it worked for Win Store.... ah, the joy of various components based on platform.  I may have to look back at NAudio, thanks for the reminder

  • 0

So, I tried the MMAudioPlayer library out myself to see what exactly was going on (including installing VS2013; creating a Windows Runtime Component Library; incorporating in the MMAudioPlayer sources). It turns out that the library code for MMAudioPlayer is Windows Runtime (WINRT) platform code (http://en.wikipedia.org/wiki/C%2B%2B/CX ; http://en.wikipedia.org/wiki/Windows_Runtime). This means that it is compiled as an unmanaged DLL; whereas, your desktop c# app is .net or common language runtime (CLR) code. The two can't inter-operate under normal circumstances. At the very least you'd have to jump through hoops to do it.

 

I played around with the options try to make MMaudioPlayer compiled as an CLR dll, however, it doesn't work because some of the used components used by MMAudioPlayer are only available via the native C++:

Error 2 error C1189: #error :  ERROR: Concurrency Runtime is not supported when compiling /clr. C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 26 1 MMAudioPlayer
Moreover, it looks like when you developing Windows Store apps, it uses something called XAML (http://en.wikipedia.org/wiki/Windows_Runtime_XAML_Framework). I'm not sure how it work internally, but that layer let's you use c# code in non-desktop apps.

 

 

See the last post here (don't bother with the tlbimp.exe, it doesn't work):

http://stackoverflow.com/questions/14028713/could-not-add-reference-to-winrt-c-dll-project

  • 0

The MMAudioPlayer source isn't unmanaged, it's essentially an interop library that lets you access DirectX's XAudio2 in managed code. Windows Store projects have an option to create something similar to a library called a runtime component. The project appears to be unmanaged but it's not. It has a manifest file that specifies how other projects can consume it.

XAML is an XML subset that you use to create user interface elements. It doesn't have anything to do with C++ or DLLs. It's common to WPF, Silverlight and Metro.

  • 0
  On 11/12/2013 at 02:53, Eric said:

The MMAudioPlayer source isn't unmanaged, it's essentially an interop library that lets you access DirectX's XAudio2 in managed code. Windows Store projects have an option to create something similar to a library called a runtime component. The project appears to be unmanaged but it's not. It has a manifest file that specifies how other projects can consume it.

XAML is an XML subset that you use to create user interface elements. It doesn't have anything to do with C++ or DLLs. It's common to WPF, Silverlight and Metro.

 

All C++/Cx code by definition is unmanaged. It's literally native C++ code with extensions (did you read the links I sent?). If it weren't, it would be compiled into CLR byte code and it is not. You can verify this by running it through an x86 disassembler* as well as attempting to run it through CLR bytecode disassembler**. The former will work, the latter will fail. With Windows Runtime Component projects you use the /Zx switch in VS so that that you can generate metadata files that operate essentially as a managed interfaces/ABIs for WINRT projects to use (e.g. store apps). These interfaces actually are managed code, or rather, in almost the same format as what you would see in CLR bytecode (e.g. so they a readable by a CLR disassembler).

 

Here's the problem, a Windows Runtime Component project's generated metadata interface file is not readable by a regular winforms or CLI C# project even though the interfaces are almost the same. Moreover, you can't reference the DLL directly because it is all native code. So you are SOL from what I can see. I don't believe there is a way around this. And I'm sure MS has some sound technical reasons for this (or just deprecation or simply no good reason at all).

 

Finally, let me clarify exactly what I was talking about w.r.t. XAML. Windows 8 has an newer XAML layer called Jupiter which allows WPF applications to interface with WINRT code. Ergo, you can create an XAML WPF C# project and then _use_ or _reference_ Runtime Component Library Project DLLs. This is how XAML is related to the DLL issue...

 

Don't believe me about the managed/unmanaged code? Here's a VS2013 C++ Windows Runtime Component project to build MMAudioPlayer (it also has pre-built DLLs) so you can fire up a disassembler and check for yourself:

https://www.dropbox.com/sh/amjbnnnkmhz1u3i/l3syTkacc3

 

* objdump, ollydbg, idapro

** ILSpy, .net reflector

  • 0
  On 11/12/2013 at 04:01, snaphat (Myles Landwehr) said:

 And I'm sure MS has some sound technical reasons for this (or just deprecation or simply no good reason at all).

DEPRECATE ALL THE THINGS seems to be the motto at Microsoft these days. Especially with everything .NET. Heck I heard Windows 8.1 deprecated a lot of Windows 8 APIs already!

  • Like 1
  • 0
  On 11/12/2013 at 21:37, Andre S. said:

DEPRECATE ALL THE THINGS seems to be the motto at Microsoft these days. Especially with everything .NET. Heck I heard Windows 8.1 deprecated a lot of Windows 8 APIs already!

 

When will they deprecate 32-bit executables ;-)

This topic is now closed to further replies.
  • Posts

    • It's very pretty, IMO. I've always loved the Windows 7-style of UI design. 7 was the prettiest Windows ever. I'd love Microsoft to be THIS consistent and I'd love them to return to that.
    • Here are the Macs that support macOS 26 Tahoe by Taras Buria In addition to iOS 26, iPadOS 26, watchOS 26, and tvOS 26, Apple announced macOS 26 Tahoe, a new desktop operating system. Like the other operating systems made in Cupertino, macOS Tahoe features a redesigned UI with Liquid Glass, translucent icons, and other visual upgrades. There are also plenty of new features, such as a new Phone app for Mac, Live Activities on Mac, a massive Spotlight update, and a lot more. However, not all Mac owners will get to enjoy macOS 26. Like with iOS and iPadOS, Apple is dropping a few Macs with the release of macOS 26. You will be able to update to the new operating system if you own one of the following Apple computers. MacBook Air M1 and newer MacBook Pro M1 and newer MacBook Pro 13-inch 2020 (four Thunderbolt 3 ports) and newer MacBook Pro 16-inch 2019 iMac 2020 and newer Mac mini 2020 and newer Mac Studio 2022 and newer Mac Pro 2019 and newer Note that although Apple still supports Intel-based Macs, not all features will be available on systems that do not have Apple Silicon chips. Now-unsupported Macs that cannot upgrade from macOS Sequoia to macOS Tahoe are the following computers with Intel processors: Intel-based iMac 2019 Intel-based Mac mini 2018 iMac Pro Intel-based MacBook Air 2020 Intel-based MacBook Pro 2018 macOS 26 Tahoe is now available for developers to try in the beta program. Apple plans to launch the first public beta in July, alongside the release of public betas of iOS 26, iPadOS 26, and other operating systems that the company announced earlier today. You can find all the new features in macOS 26 Tahoe on the official Apple website.
    • I hope Microsoft goes back to the Fisher Price XP look first.
    • >It is a fundamental change to how macOS looks and feels, which some Neowin readers are definitely not a fan of. Hehe. You link to one of my posts here, but I actually LOVE glass effects and have spent the last decade or so hacking Windows to be more like Vista's Aero Glass, etc. Not sure why you thought my post implied I didn't like it. I was referring more to Apple copying this from Windows. I wish MS would being more glass/acrylic/mica to W11 ASAP! Maybe they will...by copying Apple this time.
    • iPad, Phone and Watch just updated. Downloading this now for my MBA
  • Recent Achievements

    • Rookie
      CHUNWEI went up a rank
      Rookie
    • Enthusiast
      the420kid went up a rank
      Enthusiast
    • Conversation Starter
      NeoToad777 earned a badge
      Conversation Starter
    • Week One Done
      VicByrd earned a badge
      Week One Done
    • Reacting Well
      NeoToad777 earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      477
    2. 2
      +FloatingFatMan
      272
    3. 3
      ATLien_0
      256
    4. 4
      Edouard
      203
    5. 5
      snowy owl
      191
  • Tell a friend

    Love Neowin? Tell a friend!