• 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

    • Still won't get me in one, I prefer a human driver.
    • Sony's region restrictions on PC begin lifting, bringing back PlayStation ports for everyone by Pulasthi Ariyasinghe 2023 was when Sony began its region-locking initiative on the PC platform. The move affected over 100 countries, restricting the purchase of popular PlayStation ports and live service experiences for anyone in the regions outside of Sony's choosing. However, it seems the company is finally opening up access to these countries, starting today. While Sony has made no official announcements, which was also how the original restrictions came to be, users in these regions have begun seeing most of the publisher's catalog reappearing on their Steam store platforms. The change can be seen on affected games' SteamDB histories as well. For example, on Helldivers 2, a popular but blocked multiplayer game from before, it can be seen that the 'PurchaseRestrictedCountries' flag has been removed from a large number of countries just a few hours ago, on June 13. The controversy began in 2023 when Sony began requiring PlayStation Network accounts for their PC ports, even for games that did not have any online elements. Following an uproar, especially regarding Helldivers 2, the company reversed course and made it an optional account on PC. Unfortunately, Sony did not lift the regional restrictions it placed on the countries that do not officially support PlayStation Network accounts, which amounts to well over 100 regions. As for what may have changed the company's mind about this, Stellar Blade may have played a big role. The Sony-published action game by Shift Up just released on PC to an absolutely massive audience, with it already touting almost 200,000 concurrent players on the Steam platform. While its demo was originally region restricted, the developer had worked with Sony to remove these locks and launch the game globally. Just a few days later, almost the entire PlayStation catalog has gone through the same process. Interestingly, while massive PlayStation titles like Helldivers 2, God of War Ragnarok, Spider-Man 2, and The Last of Us Part II Remastered are back to being available across most regions, it seems Ghost of Tsushima is still under the original restrictions. It's unclear why the title has not joined the rest in shedding its locks.
    • Easy to switch off Ai on macOS, just a couple of clicks, something that is not possible on Windows, it is just hidden. Even Android it is possible at the moment to switch off AI, by not installing the app and keeping Google Assistant as it is. Not really possible to use anything else but IOS or Android for smartphones, since that is all that is available, unless I go for a non-smart phone. My problem, certainly with Windows, is that Ms thinks we all want to use AI and don't make it easy to disable. I only use my Windows machine for games these days and will be staying with Windows 10. I use my Mac for everything else, at least Apple gives the choice as i said above to turn AI off.
    • I think X3D is distinct from "X" alone, weren't most early X3D chips clock locked?
  • Recent Achievements

    • Explorer
      Case_f went up a rank
      Explorer
    • Conversation Starter
      Jamie Smith earned a badge
      Conversation Starter
    • First Post
      NeoToad777 earned a badge
      First Post
    • Week One Done
      JoeV earned a badge
      Week One Done
    • One Month Later
      VAT Services in UAE earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      537
    2. 2
      ATLien_0
      230
    3. 3
      +Edouard
      154
    4. 4
      +FloatingFatMan
      149
    5. 5
      Michael Scrip
      108
  • Tell a friend

    Love Neowin? Tell a friend!