Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Compiling in VisualStudio after building in Unity with Vuforia included

Discussion in 'Windows' started by scythwolf, May 5, 2019.

  1. scythwolf

    scythwolf

    Joined:
    Dec 30, 2018
    Posts:
    16
    Hi!

    I want to finish a project until next friday.
    Since I have to use Windows as the platform and Vuforia should only work on Windows if built for Universal Windows Platform I tried that: I installed Windows 10 SDK, switched in Build Settings to UWP and used following settings:
    upload_2019-5-5_22-19-2.png

    After building I open it in Visual Studio and click 'Start'. Then I get 2 errors. One of them:
    upload_2019-5-5_22-29-0.png
    (file [...]Plugin\\VuforiaDL.dll was not found)
    But it is actually inside the project. I was confused by that \\ and it seems that the correct path is 'Plugin\[x86 or x64]\VuforiaDL.dll.

    So far I tried to play around with the settings inside unity, nothing helped though.
    Could anyone give me a hint what I could do?

    Thanks,
    Andy
     

    Attached Files:

  2. timke

    timke

    Unity Technologies

    Joined:
    Nov 30, 2017
    Posts:
    86
    My guess is the x86/x64 in the path is produced by a VisualStudio environment variable that's missing and evaluates to an empty string.

    I suggest opening the VS project in a text editor and locate that path for the "VuforiaDL.dll" to see exactly how it's represented. You can either fix the variable (if that's the case) or simply hard code the correct path.

    It could be a Unity bug in the UWP project generation, but I can't say with this information. If you determine the bad path is coming from Unity, please open a bug for it.
     
  3. scythwolf

    scythwolf

    Joined:
    Dec 30, 2018
    Posts:
    16
    Hi!
    Thank you for your response. I opened the .sln inside the rootdirectory but there is ofc no further information. I am not sure what you mean by 'open project inside a text editor'.
    Therefor I opened the porject inside VisualStudio. I searched for VuforiaDL and found some files with Vuforia in them. But no file contained VuforiaDL. But there is Unity Date about a VuforiaDL.dll with an incorrect path. Cant edit it though...

    Here is a screenshot of the files I found
    upload_2019-5-7_20-2-48.png
     
  4. timke

    timke

    Unity Technologies

    Joined:
    Nov 30, 2017
    Posts:
    86
    VisualStudio project files (e.g. .csproj or .vcxproj) are just XML text files that are basically scripts for MSBuild. So you can open and edit them directly in order to view/edit project contents and settings. The Solution file (.sln) is just a container that references one or more projects but doesn't contain any real information itself (so ignore .sln file).

    Here's the easiest way to edit your Unity VS project files:
    1. Open your project in VS normally
    2. Assuming you built for UWP you have 3 projects: "Il2cppOutputProject", "UnityData", and your actual Unity project (which I'm going to call "Faszien" here)
    3, Right-click on your Unity project, i.e. "Faszien", and select "Unload Project" from the drop down menu
    4. Right-click on the project again and select "Edit 'Faszien'.vcxproj

    This will open the project file as an XML document, which you can now review and edit. Examine this file for VuforiaDL.dll references and see if the file paths make sense.
     
  5. scythwolf

    scythwolf

    Joined:
    Dec 30, 2018
    Posts:
    16
    Thank you for your support!
    I couldnt find a VuforiaDL.dll but several directories. A lot of them defined by variables but none seem to show the directory the dll is in (Faszien\bin\maniptest\Plugins\x86).

    Code (CSharp):
    1.   <PropertyGroup>
    2.     <OutDir>$(SolutionDir)build\bin\$(Platform)\$(Configuration)\</OutDir>
    3.     <IntDir>$(SolutionDir)build\obj\$(MSBuildProjectName)\$(Platform)\$(Configuration)\</IntDir>
    4.     <AppxBundle>Auto</AppxBundle>
    5.   </PropertyGroup>
    6.  
    Code (CSharp):
    1.  <ItemDefinitionGroup>
    2.     <ClCompile>
    3.       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
    4.       <DisableSpecificWarnings>4447;4453;4451;4691;28204</DisableSpecificWarnings>
    5.       <PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    6.       <AdditionalIncludeDirectories>$(ProjectDir);$(GeneratedFilesDir);$(IntDir);$(SolutionDir)Il2CppOutputProject\Source\CppPlugins;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    7.     </ClCompile>
    8.     <Link>
    9.       <AdditionalDependencies>WindowsApp.lib;$(OutDir)GameAssembly.lib;%(AdditionalDependencies)</AdditionalDependencies>
    10.     </Link>
    11.  
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,649
    You probably need to look inside "Unity Data.vcxitems" file.
     
  7. scythwolf

    scythwolf

    Joined:
    Dec 30, 2018
    Posts:
    16
    HI!
    Yes, found it in that file. 2 sections include a path to this file:
    Code (CSharp):
    1.     <None Include="$(MSBuildThisFileDirectory)VuforiaDL.dll">
    2.       <DeploymentContent>true</DeploymentContent>
    3.       <ExcludeFromResourceIndex>true</ExcludeFromResourceIndex>
    Code (CSharp):
    1.         <Copy SourceFiles="$(ProjectDir)Plugins\$(PlatformShortName)\VuforiaDL.dll" DestinationFiles="$(ProjectDir)VuforiaDL.dll" />
    2.             <Delete Files="$(ProjectDir)VuforiaDL.pdb" Condition="Exists('$(ProjectDir)VuforiaDL.pdb')" />
    3.             <Delete Files="$(ProjectDir)VuforiaDL.dll.mdb" Condition="Exists('$(ProjectDir)VuforiaDL.dll.mdb')" />
    4.             <Copy SourceFiles="$(ProjectDir)Plugins\$(PlatformShortName)\VuforiaDL.pdb" DestinationFiles="$(ProjectDir)VuforiaDL.pdb" Condition="Exists('$(ProjectDir)Plugins\$(PlatformShortName)\VuforiaDL.pdb')" />