Exemplo n.º 1
0
        public void ApplyToAssembly(string assemblyFilePath)
        {
            dynamic task        = Instance;
            var     buildEngine = new InMemoryBuildEngine();

            task.AssemblyFile = assemblyFilePath;
            task.BuildEngine  = buildEngine;
            if (Config != null)
            {
                //task.Config = Config;
            }
            bool result = task.Execute();

            if (buildEngine.LoggedErrors.Any())
            {
                throw new WeaverErrorException(buildEngine.LoggedErrors);
            }
            if (!result)
            {
                throw new Exception("Task did not succeed");
            }
        }
Exemplo n.º 2
0
        public void ApplyToAssembly(string assemblyFilePath)
        {
            Task task        = Instance;
            var  buildEngine = new InMemoryBuildEngine();

            SetProperty("AssemblyFile", assemblyFilePath);
            task.BuildEngine = buildEngine;

            bool result = task.Execute();

            if (buildEngine.LoggedErrors.Any())
            {
                throw new WeaverErrorException(buildEngine.LoggedErrors);
            }
            if (!result)
            {
                throw new Exception("Task did not succeed");
            }

            void SetProperty <T>(string propertyName, T value)
            {
                task.GetType().GetProperty(propertyName)?.SetValue(task, value);
            }
        }