0

Full error messsage: Could not load file or assembly 'LimitlessSoft.Buffer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

First of all I have looked at these questions and all of their answers:

I haven't found any solution that is working for me.

Here is my situation.

I have winform .NET Framework 4.0 project (no I cannot update to higher version). I had some code in it which I wanted to separate in dll so I can use it in some other project. I have created new .NET Framework 4.0 Class Library project which has only one class and it looks like this:

using System;

namespace LimitlessSoft.Buffer
{
    /// <summary>
    /// Used to buffer data
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class Buffer<T>
    {
        /// <summary>
        /// Delegate that returns object that is buffered
        /// </summary>
        /// <returns></returns>
        public delegate T SetBuffer();
        /// <summary>
        /// SetBuffer that returns object that is buffered
        /// </summary>
        private SetBuffer UpdateBuffer;

        /// <summary>
        /// Indicates when has buffer been updated last time
        /// </summary>
        public DateTime LastUpdate { get; set; }
        private T Value { get; set; }


        /// <summary>
        /// Initializes new buffer
        /// </summary>
        /// <param name="updateBuffer">Delegate that returns object being buffered</param>
        public Buffer(SetBuffer updateBuffer)
        {
            UpdateBuffer = updateBuffer;
        }


        /// <summary>
        /// Gets item from buffer that has been last time updated not greater than maximumObselence.
        /// If it cannot be found, he will do as updateIfNotFound says.
        /// If it cannot be foudn after updateIfNotFound, you will get default(T)
        /// </summary>
        /// <param name="maximumObselence">Maximum obselence for buffered item</param>
        /// <param name="updateIfNotFound">Indicates if buffer need to be updated if it has not been found at given period</param>
        /// <returns></returns>
        public T Get(TimeSpan maximumObselence, bool updateIfNotFound = true)
        {
            if (Value != null)
                if ((LastUpdate - DateTime.Now).TotalMilliseconds < maximumObselence.TotalMilliseconds)
                    return Value;

            if (updateIfNotFound)
            {
                Value = UpdateBuffer();
                LastUpdate = DateTime.Now;
                return Value;
            }

            return default(T);
        }
        /// <summary>
        /// Sets item into buffer
        /// </summary>
        /// <param name="item"></param>
        public void Set(T item)
        {
            Value = item;
            LastUpdate = DateTime.Now;
        }
        /// <summary>
        /// Updates data in buffer
        /// </summary>
        public void Update()
        {
            Value = UpdateBuffer();
            LastUpdate = DateTime.Now;
        }
    }
}

When I import this class library in my project it drops error.

Then I created new empty .NET Framework 4.0 winform application, imported this dll, initialized class, called function from it and poof it is working.

Why does same dll works in new empty project but drops error on other one?

Peter Duniho
  • 68,759
  • 7
  • 102
  • 136
Aleksa Ristic
  • 2,394
  • 3
  • 23
  • 54
  • Have you read through this one? [error-a-strongly-named-assembly-is-required](https://stackoverflow.com/questions/290980/error-a-strongly-named-assembly-is-required) – Ryan Wilson May 22 '21 at 17:06
  • Do both project have Solution file? Usually it doesn’t give error if u are building in a project scope – Akshay G May 22 '21 at 17:52

0 Answers0