CefSharp.MinimalExample.sln - Add AnyCPU Solution Platform
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<CefSharpAnyCpuSupport>true</CefSharpAnyCpuSupport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -60,6 +61,28 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\AnyCPU\Debug\net452\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;ANYCPU</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>bin\AnyCPU\Release\net452\</OutputPath>
|
||||
<DefineConstants>TRACE;ANYCPU</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
|
@@ -17,6 +17,11 @@ namespace CefSharp.MinimalExample.OffScreen
|
||||
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
#if ANYCPU
|
||||
//Only required for PlatformTarget of AnyCPU
|
||||
AppDomain.CurrentDomain.AssemblyResolve += Resolver;
|
||||
#endif
|
||||
|
||||
const string testUrl = "https://www.google.com/";
|
||||
|
||||
Console.WriteLine("This example application will load {0}, take a screenshot, and save it to your desktop.", testUrl);
|
||||
@@ -104,5 +109,26 @@ namespace CefSharp.MinimalExample.OffScreen
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Will attempt to load missing assembly from either x86 or x64 subdir
|
||||
//when PlatformTarget is AnyCPU
|
||||
#if ANYCPU
|
||||
private static System.Reflection.Assembly Resolver(object sender, ResolveEventArgs args)
|
||||
{
|
||||
if (args.Name.StartsWith("CefSharp.Core.Runtime"))
|
||||
{
|
||||
string assemblyName = args.Name.Split(new[] { ',' }, 2)[0] + ".dll";
|
||||
string archSpecificPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
|
||||
Environment.Is64BitProcess ? "x64" : "x86",
|
||||
assemblyName);
|
||||
|
||||
return File.Exists(archSpecificPath)
|
||||
? System.Reflection.Assembly.LoadFile(archSpecificPath)
|
||||
: null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user