Harmony.PatchAll ‘Cannot convert from System.Type’ to ‘System.Reflection.Assembly’

I’m here trying to repurpose a lethal company mod and using Harmony to patch the files, but when I try to build the dll file on vsc i keep getting this same error.
I’ll send the code. The error occurs at line 65 to 68.

using System;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GokuBracken.Patches;
using HarmonyLib;
using UnityEngine;

namespace GokuBracken.Core
{
    // Token: 0x0200000B RID: 11
    [BepInPlugin("", "", "")]
    public class GokuBrackenBase : BaseUnityPlugin
    {
        // Token: 0x1700001A RID: 26
        // (get) Token: 0x0600004C RID: 76 RVA: 0x000022D6 File Offset: 0x000004D6
        // (set) Token: 0x0600004D RID: 77 RVA: 0x000022DD File Offset: 0x000004DD
        internal static GokuBrackenBase Instance
        {
            get
            {
                return GokuBrackenBase._instance;
            }
            set
            {
                if (GokuBrackenBase._instance == null)
                {
                    GokuBrackenBase._instance = value;
                    return;
                }
                UnityEngine.Object.Destroy(value);
            }
        }

        // Token: 0x1700001B RID: 27
        // (get) Token: 0x0600004E RID: 78 RVA: 0x000022F9 File Offset: 0x000004F9
        public static ManualLogSource LogSource
        {
            get
            {
                return GokuBrackenBase.Instance.Logger;
            }
        }

        // Token: 0x1700001C RID: 28
        // (get) Token: 0x0600004F RID: 79 RVA: 0x00002305 File Offset: 0x00000505
        public static ConfigFile ModConfig
        {
            get
            {
                return GokuBrackenBase.Instance.Config;
            }
        }

        // Token: 0x06000050 RID: 80 RVA: 0x00002DD8 File Offset: 0x00000FD8
        private void Awake()
        {
            GokuBrackenBase.Instance = this;
            base.Logger.LogInfo("Initializing config...");
            ConfigManager.InitializeConfig();
            base.Logger.LogInfo("Loading asset bundle...");
            Assets.PopulateAssets();
            base.Logger.LogInfo("");
            base.Logger.LogInfo("");
            this.Harmony.PatchAll(typeof(GokuBrackenBase));
            this.Harmony.PatchAll(typeof(EnemyPatches));
            this.Harmony.PatchAll(typeof(TerminalPatches));
            this.Harmony.PatchAll(typeof(RoundManagementPatches));
        }

        // Token: 0x04000018 RID: 24
        private static GokuBrackenBase _instance;

        // Token: 0x04000019 RID: 25
        private readonly Harmony Harmony = new Harmony("");
    }
}

the specific lines that error are:

            this.Harmony.PatchAll(typeof(GokuBrackenBase));
            this.Harmony.PatchAll(typeof(EnemyPatches));
            this.Harmony.PatchAll(typeof(TerminalPatches));
            this.Harmony.PatchAll(typeof(RoundManagementPatches));

note that EnemyPatches, TerminalPatches, and RoundManagementPatches are cs files.
I tried using Assembly.GetExecutingAssembly and GetCallingAssembly, but it still gives me a similar error.

New contributor

Noon Animates is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

PatchAll(Assembly)
searches an assembly for Harmony annotations and uses them to create patches

The output of typeof(anything) is a System.Type, a type does have a property that you can use to access the assembly, but if all your classes are .cs files in the same project then they will all return the same assembly, which means you normally only need one of these PatchAll invocations:

this.Harmony.PatchAll(typeof(GokuBrackenBase).Assembly);

I tried using Assembly.GetExecutingAssembly and GetCallingAssembly, but it still gives me a similar error.

This error would be different to what you have posted and might be due to not having any annotations in your code files to configure your monkey patches.

The first step should be to read the Harmony documentation, generally for modding there are other options, Harmony provides many advanced capabilities but you will need a better understanding of C# to get the most out of it as the documentation assumes an intermediate understanding of this type of development.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật