Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7769759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:14:15+00:00 2026-06-01T16:14:15+00:00

I have the following code: namespace FVProductions.Base { public struct Color { public byte

  • 0

I have the following code:

namespace FVProductions.Base
{
    public struct Color
    {
        public byte B, G, R, A;

        public Color(float r, float g, float b, float a)
        {
            R = (byte)(Math.Min(1.0f, Math.Max(0.0f, r)) * 255);
            G = (byte)(Math.Min(1.0f, Math.Max(0.0f, g)) * 255);
            B = (byte)(Math.Min(1.0f, Math.Max(0.0f, b)) * 255);
            A = (byte)(Math.Min(1.0f, Math.Max(0.0f, a)) * 255);
        }

        public Color(Vector3 rgb)
            :this(rgb.X,rgb.Y,rgb.Z,1)
        {
        }
    }
}

namespace FVProductions.Base.Graphics
{
    public class ShaderParameter<T>
    {
        private T Value;
        public T GetValue() { return Value; }
    }
}

namespace FVProductions.NewGame
{
    public class TerrainShader : Shader, IFullTextured, IStandardLit
    {
        private ShaderParameter<Vector3> epAmbient;

        public FVProductions.Base.Color AmbientColor
        {
            get { return new FVProductions.Base.Color(epAmbient.GetValue()); }
            set { epAmbient.SetValue(value.ToVector3()); }
        }
    }
}

The type, FVProductions.Base.Color is in a referenced library. epAmbient.GetValue returns a Vector3 and FVProductions.Base.Color has a constructor with a single Vector3 parameter. The project does not reference System.Drawing. However, the compiler is generating the following error:

error CS0012: The type ‘System.Drawing.Color’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.

That’s on the TerrainShader.AmbientColor get{} line, at the return keyword. Why would the compiler ever assume an explicitly declared type is another?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:14:17+00:00Added an answer on June 1, 2026 at 4:14 pm

    Found it. FVProductions.Base.Color is a base class in a base library and has a constructor that accepts a System.Drawing.Color. The project that has the problem code does not reference System.Drawing. When using the Color class, it was having trouble linking the System.Drawing.Color constructor even though it wasn’t used. So, I discovered two solutions:

    Have the upper library reference the System.Drawing library even though it won’t be used.

    Remove the System.Drawing.Color constructor from FVProductions.Base.Color.

    Either will allow the project to compile.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: #include <iostream> #include <vector> using namespace std; struct A{};
I have the following (C#) code namespace A { public interface IX { bool
I have following code: #include <iostream> using namespace std; template<class T> T max(T *data,int
I have been sharing database variables using the following code: Namespace DataAccessVariables Public Class
I have the following C# code: namespace ISeeOptic.BL { public abstract class Process {
I have the following code namespace A { [DataContract] public class CustomClass {} }
I have the following code: #include <boost/smart_ptr/shared_ptr.hpp> #include <boost/numeric/interval.hpp> #include <boost/math/distributions/students_t.hpp> using namespace boost::numeric;
I have the following code snippet: void foo(double a) {} namespace bar_space { struct
So I have the following the code: namespace ConsoleApplication1 { public delegate int Transformer(int
I have the following code: [DataContract(Namespace = )] public class User { [DataMember] public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.