your GitHub project does not include the referenced library project:
<ProjectReference Include="..\..\..\Library\Library\Library\Library.csproj">
which is several folder above the repo root
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Dear All,
I am trying to call the code in "Library.cs" from a control in "BaseControlLibrary.cproj". I plan to add more controls to BaseControlLibrary.cproj. The complete code of the project is uploaded to https://github.com/benyltam/NewTims on GitHub.com. The errors are as follows. Could I know how to fix them?
your GitHub project does not include the referenced library project:
<ProjectReference Include="..\..\..\Library\Library\Library\Library.csproj">
which is several folder above the repo root
There's a Library.exe in bin folders. The Library project should be a class library and produce a DLL not an EXE.
A couple of things
Build results
2>C:\OED\DotnetLand\VS2022\TimsSolution\BaseControlLibrary\CheckBox.cs(30,21,30,27): warning CS0108: 'CheckBox.Resize()' hides inherited member 'Control.Resize'. Use the new keyword if hiding was intended.
2>C:\OED\DotnetLand\VS2022\TimsSolution\BaseControlLibrary\CheckBox.cs(16,20,16,30): warning CS0169: The field 'CheckBox.DefaultTop' is never used
2>C:\OED\DotnetLand\VS2022\TimsSolution\BaseControlLibrary\CheckBox.cs(18,20,18,33): warning CS0169: The field 'CheckBox.DefaultHeight' is never used
2>C:\OED\DotnetLand\VS2022\TimsSolution\BaseControlLibrary\CheckBox.cs(17,20,17,31): warning CS0169: The field 'CheckBox.DefaultLeft' is never used
2>C:\OED\DotnetLand\VS2022\TimsSolution\BaseControlLibrary\CheckBox.cs(19,20,19,32): warning CS0169: The field 'CheckBox.DefaultWidth' is never used
2> BaseControlLibrary -> C:\OED\DotnetLand\VS2022\TimsSolution\BaseControlLibrary\bin\Debug\BaseControlLibrary.dll
========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========
Revised button code
using System.Drawing;
using System.Windows.Forms;
using Library;
namespace BaseControlLibrary
{
[ToolboxBitmap(@"Button.bmp")]
public partial class Button : UserControl
{
static int DefaultTop;
static int DefaultLeft;
static int DefaultHeight;
static int DefaultWidth;
private readonly Lib _library = new Lib();
public Button()
{
InitializeComponent();
DefaultTop = Top;
DefaultLeft = Left;
DefaultHeight = Height;
DefaultWidth = Width;
//_library.ResizeCtrl(/* TODO */);
}
}
}
What I mean is rename one of the Library classes or use using aliases
static
I try to put the DLL file into the bin folder.
There are two default folders in the bin folders depending on the project type; Debug and Release. The DLL must go into Debug folder while the project is is configured for Debug and Release when the solution is configured for a Release build. Once deployed there will be one bin folder.
However, do not copy the DLL yourself! Create a project reference to the Library project as I recommended several times!!!! From my perspective you're performing random tasks with no idea what you're doing and you're making no effort to learn.
These forum expect foundational experience which you clearly do not have at this point. You might consider an instructor lead course so you can get one on one support with the instructor.
My last effort to help you - I created a public GitHub project based on your posts. There is one solution named NewTims with three projects.
https://github.com/mjgebhard/NewTims
BaseControlLibrary - Windows Forms Control Library (.NET Framework)
Library - Class Library (.NET Framework)
NewTims - Windows Forms App (.NET Framework)
The three projects are all within a single folder named NewTims.
Use this GitHub project to compare what you are doing.
Hi @Jack J Jun
No, Jack. I just made an apology to the one that I reply.