2 * Copyright(c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 namespace Tizen.NUI.Xaml.Build.Tasks
22 class XamlCAssemblyResolver : DefaultAssemblyResolver
24 public void AddAssembly(string p)
26 RegisterAssembly(AssemblyDefinition.ReadAssembly(p, new ReaderParameters
28 AssemblyResolver = this
32 public override AssemblyDefinition Resolve(AssemblyNameReference name)
34 if (TryResolve(name, out AssemblyDefinition assembly))
37 && ( TryResolve(AssemblyNameReference.Parse("mscorlib"), out assembly)
38 || TryResolve(AssemblyNameReference.Parse("netstandard"), out assembly)
39 || TryResolve(AssemblyNameReference.Parse("System.Runtime"), out assembly)))
41 throw new AssemblyResolutionException(name);
44 bool TryResolve(AssemblyNameReference assemblyNameReference, out AssemblyDefinition assembly)
47 assembly = base.Resolve(assemblyNameReference);
50 catch (AssemblyResolutionException e) {
56 static bool IsMscorlib(AssemblyNameReference name)
58 return name.Name == "mscorlib"
59 || name.Name == "System.Runtime"
60 || name.Name == "netstandard";