示例#1
0
 private void SetupUSS()
 {
     if (Installation.GetFileLayoutType() == FileLayoutType.Installed)
     {
         AssemblyLoader.Install();
         AssemblyLoader.AddSearchDirectory(Path.Combine(Installation.GetInstallDirectory(), "Plugins", "Services"));
     }
     UserServices.Setup(true);
 }
示例#2
0
        public static void CheckStructWithPack()
        {
            var assemblyLoader = new AssemblyLoader();

            assemblyLoader.AddSearchDirectory(Path.GetDirectoryName(typeof(Types).Assembly.Location));
            var ilCompiler = new ILCompiler(new ExtendedCompilerBackend(new NopCompilerBackend()));

            // Check exception for fixed size layout
            {
                var structType = assemblyLoader.Resolve(typeof(StructWithPack));
                var ex         = Assert.Throws <CompilerException>(() => ilCompiler.CompileType(structType));
                StringAssert.Contains("The packing size `8` of the struct", ex.Message);
            }
        }
        private static void InitializeExtensions()
        {
            // This method is only needed to make references to types in an extension assembly from Razor working. Unfortunately
            // the BuildManager.AddReferencedAssembly() method has to be called very early in the application life cycle, so that
            // we cannot do it in Global.asax.cs as usual.

            var directoriesAdded = new List <string>();

            Composer.Instance.Compose();
            var assemblies = Composer.Instance.GetAllAssemblies();

            foreach (var assembly in assemblies)
            {
                var directory = Path.GetDirectoryName(assembly.Location);
                Log.Debug("Loading assembly {0} into Razor BuildManager", assembly.Location);
                if (!directoriesAdded.Contains(directory))
                {
                    AssemblyLoader.Install();
                    AssemblyLoader.AddSearchDirectory(directory);
                }

                BuildManager.AddReferencedAssembly(assembly);
            }
        }