Reputation: 1794
I have my project that can build for x64, x86 and ARM (WinRT) referencing to a platform specific library (Also builds on x64, x86 and ARM). In order to conditionally build the platform specific DLL, I edited the .csproj file manually to have the elements for those platform specific DLL as below:
<ItemGroup Condition="'$(Platform)' == 'x86'">
<Reference Include="PortablePlatform">
<HintPath>..\..\packages\LibraryName\x86\PortablePlatform.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup Condition="'$(Platform)' == 'x64'">
<Reference Include="PortablePlatform">
<HintPath>..\..\packages\LibraryName\x64\PortablePlatform.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup Condition="'$(Platform)' == 'ARM'">
<Reference Include="PortablePlatform">
<HintPath>..\..\packages\LibraryName\ARM\PortablePlatform.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
Now, I am able to compile my solution. But, in runtime it gives error while loading the platform specific DLLs (PortablePlatform.dll) and the error is thrown in return statement of GetXamlType in xamlTypeInfo.g.cs:
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlType(global::System.Type type)
{
if(_provider == null)
{
_provider = new global::<ABC>_App_XamlTypeInfo.XamlTypeInfoProvider();
}
return _provider.GetXamlTypeByType(type);
}
Below is the error stack: An exception of type 'System.IO.FileNotFoundException' occurred in .WinRT.App.exe but was not handled in user code Additional information: Could not load file or assembly 'PortablePlatform, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Upvotes: 1
Views: 393
Reputation: 1794
I was able to figure out the issue. I had to remove <Private>True/False</Private>
from <Reference>
element in csproj file. Not very sure, but I think it was causing the previously built dll to be loaded in runtime.
Upvotes: 1