Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Unity 5.3.0f1] .winmd file isn't moved correctly (UWP)

Discussion in 'Windows' started by Maisey, Nov 19, 2015.

  1. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    Hello,

    I'm having an empty project and trying to build the Unity project to an UWP C# Project. But I'm having some issues.

    I'm having the following folder strcuture:

    Code (CSharp):
    1. Plugins >
    2.    MyPlugin.winmd (no settings changed)
    3.    ARM >
    4.       MyPlugin.dll (also marked this as ARM in the settings)
    5.    x86 >
    6.       MyPlugin.dll (also marked this as x86 in the settings)
    But once the project is built the Assembly-CSharp(and -firstpass) (Universal Windows) is missing the references to MyPlugin.winmd, or rather, it's there, but the "path" is empty and the project complains that it can't find the classes.

    Somewhere, somehow I got a project that doesn't have this problem (I tried a lot of things and not sure which one made it work). But in that project the only difference is that MyPlugin.winmd has been copied to this path (not manually):

    Code (CSharp):
    1. C:\<Insert Path To My Unity Project Here>\UWP\Assembly-CSharp\bin\ARM\Debug\MyPlugin.winmd
    And that it is that path that is referenced in the actual UWP C# Project (in the project that works).

    So my question is; when is the MyPlugin.winmd file copied to that location (so that I can get this to work)?
     
    Last edited: Nov 19, 2015
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,722
    The simplest solution would probably be to put the same winmd file to both x86 and ARM subdirectories and set the same import settings to them as dlls.
     
  3. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    In Unity 5.3 you can't have two .winmd files and you can't change their import settings to be neither ARM or x86 (it's always "Any CPU"). (It is said in the changelogs for Unity 5.3)

    Error if one does:

    Code (CSharp):
    1.  
    2. Plugin 'MyPlugin.winmd' is used from several locations:
    3. Assets/Plugins/ARM/MyPlugin.winmd would be copied to <PluginPath>/MyPlugin.winmd
    4. Assets/Plugins/x86/MyPlugin.winmd would be copied to <PluginPath>/MyPlugin.winmd
    5. Please fix plugin settings and try again.
    6.  
    7. UnityEditor.Modules.DefaultPluginImporterExtension:CheckFileCollisions(String)
    8. UnityEditorInternal.PluginsHelper:CheckFileCollisions(BuildTarget) (at C:/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
    9. UnityEditor.HostView:OnGUI()
     
    Last edited: Nov 19, 2015
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,645
    This is a known bug in 5.3. We have a fix internally already (actually, I just fixed it 2 hours ago). This only happens if you have "C# projects" checkbox checked. Building without C# projects should work.

    Generated C# projects get confused and reference the winmd from wrong directory. Workaround is replacing this:

    <HintPath>$(SolutionDir)$(SolutionName)\Plugins\$(PlatformShortName)\Plugin.winmd</HintPath>
    With this:

    <HintPath>$(SolutionDir)$(SolutionName)\Plugin.winmd</HintPath>in generated Assembly-CSharp and Assembly-CSharp-firstpass project files.

    I'm not yet sure which release the fix will be in: it might be final 5.3, or one of the first patch releases.
     
  5. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    Thank you for confirming @Tautvydas Zilys !

    Do I have to do this once or every time I build the project?
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,645
    Probably every time you build it. Another solution would be to drop your winmd file into this directory:

    Code (csharp):
    1. $(SolutionDir)$(SolutionName)\Plugins\$(PlatformShortName)\Plugin.winmd
    You'd only need to do it the first time you build the project in that case.
     
  7. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    Thank you, I think I'll go with solution 2 then. ;)