Search Unity

Microsoft UnityPlugins (Advertising)

Discussion in 'Windows' started by kaekko, Mar 2, 2016.

  1. kaekko

    kaekko

    Joined:
    Aug 10, 2012
    Posts:
    7
    I have compiled https://github.com/Microsoft/unityplugins but when I import the created package: Microsoft.UnityPlugins.Advertising.unitypackage it imports the same dll 4 times in different subfoldes:

    pacakge.png

    If I tryu to build, I get the following error:
    Code (CSharp):
    1. Plugin 'Microsoft.UnityPlugins.Advertising.dll' is used from several locations:
    2. Assets/Plugins/WSA/x64/Microsoft.UnityPlugins.Advertising.dll would be copied to <PluginPath>/Microsoft.UnityPlugins.Advertising.dll
    3. Assets/Plugins/WSA/x86/Microsoft.UnityPlugins.Advertising.dll would be copied to <PluginPath>/Microsoft.UnityPlugins.Advertising.dll
    4. Assets/Plugins/Microsoft.UnityPlugins.Advertising.dll would be copied to <PluginPath>/Microsoft.UnityPlugins.Advertising.dll
    5. Assets/Plugins/WSA/ARM/Microsoft.UnityPlugins.Advertising.dll would be copied to <PluginPath>/Microsoft.UnityPlugins.Advertising.dll
    6. Plugin 'Microsoft.UnityPlugins.Common.dll' is used from several locations:
    7. Assets/Plugins/WSA/x64/Microsoft.UnityPlugins.Common.dll would be copied to <PluginPath>/Microsoft.UnityPlugins.Common.dll
    8. Assets/Plugins/WSA/ARM/Microsoft.UnityPlugins.Common.dll would be copied to <PluginPath>/Microsoft.UnityPlugins.Common.dll
    9. Assets/Plugins/WSA/x86/Microsoft.UnityPlugins.Common.dll would be copied to <PluginPath>/Microsoft.UnityPlugins.Common.dll
    10. Please fix plugin settings and try again.
    11.  
    12. UnityEditor.Modules.DefaultPluginImporterExtension:CheckFileCollisions(String)
    13. UnityEditorInternal.PluginsHelper:CheckFileCollisions(BuildTarget) (at C:/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
    14. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
    15.  
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Check their settings in Plugin Inspector. Make sure they are set to be compatible only with their respective platforms/archs etc and all have placeholders set properly.
     
  3. kaekko

    kaekko

    Joined:
    Aug 10, 2012
    Posts:
    7
    I'm not 100% shure how compile the platforms correctly.

    If I'm right, on \Plugins\***.dll I should select Editor only:
    Plugins.png

    The other three are all set to WSAPlayer only:
    • \Plugins\WSA\ARM\***.dll
    • \Plugins\WSA\x64\***.dll
    • \Plugins\WSA\x86\***.dll
    For example, for x64 if I select Placeholder, I see the following options. What should I choose?
    x64.png

    I'm building for Windows 10 Universal.
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    The placeholder must be a dll that is compatible with the editor, usually the one you place in Plugin directory directly.
     
  5. kaekko

    kaekko

    Joined:
    Aug 10, 2012
    Posts:
    7
    If I set the following configuration in the three dlls under:
    • \Plugins\WSA\ARM\***.dll
    • \Plugins\WSA\x64\***.dll
    • \Plugins\WSA\x86\***.dll
    ARM.png

    I get the following errors:
    Code (CSharp):
    1. Plugin 'Microsoft.UnityPlugins.Advertising.dll' is used from several locations:
    2. Assets/Plugins/WSA/x64/Microsoft.UnityPlugins.Advertising.dll would be copied to <PluginPath>/Microsoft.UnityPlugins.Advertising.dll
    3. Assets/Plugins/WSA/x86/Microsoft.UnityPlugins.Advertising.dll would be copied to <PluginPath>/Microsoft.UnityPlugins.Advertising.dll
    4. Assets/Plugins/WSA/ARM/Microsoft.UnityPlugins.Advertising.dll would be copied to <PluginPath>/Microsoft.UnityPlugins.Advertising.dll
    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()
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    They're all managed DLLs. You only need one of them. Just keep either x64 or ARM one and delete the other ones.
     
  7. adampound

    adampound

    Joined:
    Jul 14, 2014
    Posts:
    28
    you guys ever get this working? Having same issue. Not sure why they wouldnt just release the unity package instead having to go through all this.
     
  8. EzekielDeAngelo

    EzekielDeAngelo

    Joined:
    Feb 23, 2016
    Posts:
    1
    I managed to make it work yesterday following the instructions given on the website https://github.com/Microsoft/unityplugins to create Microsoft.UnityPlugins.Advertising.unitypackage and keeping only one managed DLL (the ARM one) as advised above by Tautvydas Zilys.

    Then to display ads on devices, you need to include the file https://github.com/Microsoft/unityp...outWin10/VideoAdsSample/MicrosoftAdsBridge.cs in your build and add the following line in the InitializeUnity function located in the App.xaml.cs file :
    Code (CSharp):
    1. Microsoft.UnityPlugins.MicrosoftAdsBridge.InterstitialAdFactory = new Microsoft.UnityPlugins.MicrosoftAdsFactory();
    However, I hoped that there was an easier way to get there and as I want to display a banner ad and not a video ad I guess I'm not done with headaches yet...
     
  9. TGKG

    TGKG

    Joined:
    Dec 31, 2014
    Posts:
    180
    Well done Eze...
    I have NOT been able to get a build from Unity to work following the above instructions.
    1. I have used the unityplugin from https://github.com/Microsoft/unityplugins
    2. I have successfully created the unitypackage following those instructions
    3. I have successfully imported the package into the sample VideoAdsSample from https://github.com/Microsoft/unityplugins
    4. I kept only the ARM folder as per the above Tautvydas Zilys instructions
    4. I have changed the Plugins / Microsoft.UnityPlugins.Advertising.dll from "Any Platform" to "Editor"
    upload_2016-3-14_20-5-5.png

    5. The ARM folder Microsoft.UnityPlugins.Advertising.dll is set to WSAPlayer and Placeholder is set to either "none" or to the Microsoft.UnityPlugins.Advertising.dll in the Plugins folder.
    upload_2016-3-14_20-11-54.png

    When I build as either a Universal 8.1 or 8.1 I get the same 2 error
    upload_2016-3-14_20-13-9.png

    Two errors are as follows:

    Error building Player: UnityException: Failed to run reference rewriter with command --target="Temp\StagingArea\VideoAdsSample.Windows\Microsoft.UnityPlugins.Advertising.dll" --additionalreferences="Temp\StagingArea\VideoAdsSample.Windows" --platform="C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral\Windows.winmd" --support="Temp\StagingArea\VideoAdsSample.Windows\WinRTLegacy.dll" --supportpartialns=Unity.Partial --system=System --dbg=pdb --framework="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5.1" --alt=System.Xml.Serialization --ignore=System.IConvertible,mscorlib.
    Catastrophic failure while running rrw: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Advertising, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null'
    at Unity.SearchPathAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
    at Unity.SearchPathAssemblyResolver.Resolve(AssemblyNameReference name)
    at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
    at Mono.Cecil.TypeReference.Resolve()
    at Unity.ReferenceRewriter.RewriteTypeReferences.Visit(TypeReference type, String referencingEntityName)
    at Unity.ReferenceRewriter.ReferenceDispatcher.Visit(TypeReference type, String referencingEntityName)
    at Unity.ReferenceRewriter.ReferenceDispatcher.DispatchFields(TypeDefinition type, String referencingEntityName)
    at Unity.ReferenceRewriter.ReferenceDispatcher.Dispatch(TypeDefinition type)
    at Unity.ReferenceRewriter.ReferenceDispatcher.Dispatch()
    at Unity.ReferenceRewriter.RewriteTypeReferences.Run()
    at Unity.ReferenceRewriter.RewriteOperation.Execute(RewriteContext context)
    at Unity.ReferenceRewriter.Program.Main(String[] args)
    ========================

    UnityException: Failed to run reference rewriter with command --target="Temp\StagingArea\VideoAdsSample.Windows\Microsoft.UnityPlugins.Advertising.dll" --additionalreferences="Temp\StagingArea\VideoAdsSample.Windows" --platform="C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral\Windows.winmd" --support="Temp\StagingArea\VideoAdsSample.Windows\WinRTLegacy.dll" --supportpartialns=Unity.Partial --system=System --dbg=pdb --framework="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5.1" --alt=System.Xml.Serialization --ignore=System.IConvertible,mscorlib.
    Catastrophic failure while running rrw: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Advertising, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null'
    at Unity.SearchPathAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
    at Unity.SearchPathAssemblyResolver.Resolve(AssemblyNameReference name)
    at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
    at Mono.Cecil.TypeReference.Resolve()
    at Unity.ReferenceRewriter.RewriteTypeReferences.Visit(TypeReference type, String referencingEntityName)
    at Unity.ReferenceRewriter.ReferenceDispatcher.Visit(TypeReference type, String referencingEntityName)
    at Unity.ReferenceRewriter.ReferenceDispatcher.DispatchFields(TypeDefinition type, String referencingEntityName)
    at Unity.ReferenceRewriter.ReferenceDispatcher.Dispatch(TypeDefinition type)
    at Unity.ReferenceRewriter.ReferenceDispatcher.Dispatch()
    at Unity.ReferenceRewriter.RewriteTypeReferences.Run()
    at Unity.ReferenceRewriter.RewriteOperation.Execute(RewriteContext context)
    at Unity.ReferenceRewriter.Program.Main(String[] args)

    PostProcessWinRT.RunReferenceRewriter () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:566)
    PostProcessUniversal81.RunReferenceRewriter () (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessUniversal81.cs:123)
    PostProcessWinRT.Process () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:123)
    PostProcessUniversal81.Process () (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessUniversal81.cs:42)
    UnityEditor.Metro.BuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:133)
    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
    UnityEditor.HostView:OnGUI()



    Tautvydas Zilys or anyone at Unity can you provide some help please.

    Thank you
     
  10. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Do you have Microsoft.Advertising among your plugins inside Unity? It fails to find this assembly.
     
  11. TGKG

    TGKG

    Joined:
    Dec 31, 2014
    Posts:
    180
    Well, I believe that is what is in the plugin folder. It is the Microsoft.UnityPlugins.Advertising.dll.

    Where do you see in the error message that it cannot find a Microsoft.Advertising?
     
  12. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    This part of error:
    Catastrophic failure while running rrw: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Advertising, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null'

    Which I believe is one more dll/winmd file.
     
  13. TGKG

    TGKG

    Joined:
    Dec 31, 2014
    Posts:
    180
    I have imported the Microsoft.Advertising.dll.
    Now how do I use it?
     
  14. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Place it along other plugins and mark properly in plugin inspector.
     
  15. TGKG

    TGKG

    Joined:
    Dec 31, 2014
    Posts:
    180
    Place along other plugins where?
    How to mark properly?
     
  16. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Microsoft.UnityPlugins.Advertising.dll is the one you had a failure with, because it references Microsoft.Advertising.dll. So place Microsoft.Advertising.dll alongside the Microsoft.UnityPlugins.Advertising.dll (the one used for WSA) and also set plugin settings for that dll to be WSA-only.
     
  17. TGKG

    TGKG

    Joined:
    Dec 31, 2014
    Posts:
    180
    Thank you Aurimas
     
  18. pan-master

    pan-master

    Joined:
    Nov 11, 2013
    Posts:
    127
    hey so I downloaded that package but it looks like the package is not complie to use in Unity. So i have to do some additional build inVS to get all the needed DLLs. its said that some powershall is needed.. well Iam so confused
     
  19. ClaytonOne

    ClaytonOne

    Joined:
    Sep 5, 2015
    Posts:
    89
  20. FlashMuller

    FlashMuller

    Joined:
    Sep 25, 2013
    Posts:
    451
    @TGKG I basically have the very same issue as you had. I found a Microsoft.Advertising.dll (which on did you use? I only found one in an x86 Folder) and this doesn't help - very same issue. Could you walk me through? Which dll and what settings in which UnityFolder? Thanks!
     
  21. MuhammadHaseeb56

    MuhammadHaseeb56

    Joined:
    Mar 12, 2019
    Posts:
    13