I've managed to successfully implement this custom TabControl project. I'm Building this TabControl project as a .dll file so I can drag it into my other project's toolbox and view the custom control in the designer but when I wanted to change something in the this custom TabControl project, when I rebuild the .dll file and drag it in the toolbox again, it doesn't update the existing custom controls in the designer.
When I ctrl+m1 the variables in the custom control in use, it links to read-only metadata.
Do I need to remove all the custom controls first whenever I make a change or is there a way to "update" existing custom toolbox items that are already in the designer?
I tested this issue in vs2019 and vs2022, and it worked perfectly.
When the dll is rebuilt, it does not need to be reloaded into the toolbox.
If the program page that depends on the dll is not updated, just rebuild it.
My test environment is .Net Framework 4.8.
If you have any questions about this, please let me know and I will continue to follow up.
I am working on a C# project which requires reading of a word file.
I have microsoft.office.interop.word in my machine's Global Assembly Cache but still it would NOT show up in Visual Studio's Project reference list.
Any thoughts?
There is a browse button in the Add References dialog that lets select an arbitrary .NET dll to add as a reference. Since you have already found the dll in the GAC, you can just copy the path into that dialog and add from there.
While it has been a while since I have worked with the interop with Office via a .NET program, there is also the COM tab in the dialog and I believe that should have a reference to Word. That may be the one that you are supposed to use.
I have looked everywhere and cannot find a solution. My problem has the following elements:
I have a Visual Studio Solution (Visual Studio 2013) with several projects.
One project ("Control Project") has several user controls I built.
Other projects ("Other Control Projects") contain various open source controls.
Another project (the "Problem Project") references the Control Project and the Other Control Projects.
The Visual Designer toolbox shows the Other Control Project controls perfectly in my Problem Project.
The Visual Designer fails to show the Control Project controls in my Problem Project.
I have tried:
1. Making sure the option to auto-populate the toolbox is checked.
2. Rebuilding the solution
3. Resetting the toolbox
4. Ensuring the access modifiers for the controls are Public.
If I "Choose Items", I can add the Control Project controls to the Problem Project by selected the .exe but this seems like a hack and also has caused other problems that are difficult to define.
Anybody have any clues on what may be wrong with either my Problem Project or my Control Project?
That answer might be a bit late but I recently had the same Problem.
For me it was a Problem with missing DLLs.
I have a nearly simular Soloution like you.
A Library providing selfmade UserControls
Another project ("Problem Project") that references the Control Library
The problem occurred when I recently switched from VS2008 to VS2013 and from .NET Framework 3.5 to .NET Framework 4.5. The cause of the Problem for me seems to be with Crystal Reports references. In my Library project I have a Class that inherits from CrystalDecisions.CrystalReports.Engine.ReportClass. This Class I provide as a control in the Toolbox. When I open the Library Project itself (not as a Subproject) and open a Form to load the Toolbox I got the following Error: Failed to create ToolboxItem of type: CrystalDecisions.VSDesigner.ReportToolboxItem, CrystalDecsions.VSDesigner.
After I knew this I found out, that I have to copy some Librarys, in my case
CrystalDecisions.CrystalReports.Engine.dll
CrystalDecisions.Shared.dll
CrystalDecisions.VSDesigner
to C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE (found it here:Can't add project controls to the Visual Studio Toolbox)
To me it seems like VS Toolbox starts to create the Controls and gets an Error at one of them and stops to fill the Toolbox. In my case the problem might be, that I reference old CR Librarys (v12.x) which work with CLR 2.0 and .NET Framework 2.0 - 3.5 and I compile my project with .NET Framework 4.5 which works with CLR 4.0. It looks like the old Librarys are not supported in .NET 4.x. If I use this Workaround the Toolbox works fine for me.
Greetings
btw. sorry for the patchy english ;-)
I will surely go mad if I don't know what is the reason for this :) :
I have several projects in my solution. The problem I'm getting is in a solution where I'm adding reference of another.
In 1 project I have my custom controls (purely .cs files) and another solution is test pages which are only ASPX pages (without any code behind file - since the entire operation is performed by the controls)
Now the problem is when I added the reference of my Custom Controls project to my Web pages project, the code which I wrote in custom control is not getting affected. I added a new property for my custom textbox control which is not coming in the intellisense in my HTML markup and the break point I'm setting is not getting a hit (inside custom controls code).
This is working fine in .NET 3.5 Framework. (We have 2 branches; one is 3.5 and another is 4.0) but is NOT working in .NET Framework 4.0. I'm using Windows 2008 Server R2.
What I have did uptil now:
Checked the target framework for both the projects (4.0 for both).
Copied and pasted the assembly where ever required.
Try adding your "Custom Control" to ASP.NET project Toolbox panel in Visual Studio (It worked for me once!).
Are the reference project's dll falling in bin folder after build/rebuild?
Have you registered your control in your ASPX page?
Also, when you are saying you have reference to project then what is the reason behing copying and pasting?
I'm getting the following error
Could not find type 'My.Special.UserControl'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU.
But what doesn't make any sense is that My.Special.UserControl is in the same assembly as the form. What's more, if I view code on the Designer.cs file, There are references to My.Special.UserControl that seem to be fine. The assembly builds fine, and runs fine as well. It's the just the designer that's having issues.
As such we have to do all our design work by making adjustments to the Designer.cs file by hand. How can I make the designer work again?
The following procedure has worked for me:
Delete the /bin and /obj folders in your source code directory.
Restart VS (be sure the offending Form Designer is closed)
Compile
Open the Form in Designer again. The problem should be resolved.
I'm sure deleting both /bin and /obj are not necessary, but I haven't been able to reproduce the error and come to a more specific solution. (My projects are typically small enough that re-compiling the whole thing is no big deal.)
Usually, this error seems to occur after refactoring / renaming objects of the offending class. So my guess is that there is a VS bug that doesn't recompile the appropriate object file after a User Control or Custom Control is refactored.
Change the project type temporarily to x86, compile and open the Designer. Visual Studio is a 32 bit application.
There is propably an exception happening in the Load or Initialize Part of your Form / UserControl. Can you try to comment out any code there and retry opening in designer?
You can use another instance of Visual Studio to attach a debugger to your Visual Studio instance not letting you open the Form. Once an exception occurs you will be able to pinpoint the location where something goes wrong.
I had similar problem when shifted from VS 2017 community edition to professional.
Close VS
Go to Project folder
Delete .vs folder. Back up if you need.
Start VS
This should solve the problem
I have experienced the exact same problem. I am fairly certain that it is connected to the platform target x64. Here is a related post mentioning it as a bug in Visual Studio:
https://stackoverflow.com/a/11582828/7665665
How I deal with it: Although my solution is actually only x64, I have created another platform target x86 for the projects just to be able to use the designer. Now I switch the target to x86 in order to see my controls in VS Designer. For everything else, I switch back to x64.
I had the same problem with a user control which was derived from the standard .NET control within my form.cs. Nothing of the above worked for me (my solution is compiled as x64 because of other unmanaged components which only support x64).
I finally ended up with creating a separate project "Utils" and moving the offending derived controls to this project. This worked like a charm !
In my case I just unload project and reload again
Switching the project target to x86 was the only possible solution for me
This happened to me today. Cleaning, Rebuilding, restarting Vs and even rebooting did not help. Everything ran as expected, the only thing that would not work was the designer in VS.
In my case, since nothing lese worked, I went to designer file, removed the faulty control and then added a new one. Renamed, re-assigned event listeners and it worked.
Designer now works, but if this must be some kind of VS bug, I don't know.
This is not the answer I'd like to read when coming to SO, but I'll post it in case it helps anyone later.
For me, I deleted the .resx file for the form, and it built and showed up in the designer, no problem. Go figure....
I had a similar experience when I sub-classed DataGridView. The following procedure has worked for me:
Close the Form Designer tab
Close VS (2015)
Delete the /bin and /obj folders of the project
Restart VS
Rebuild the solution
I don't know which steps could be skipped as I have not taken the time to refine the process.
On my project, it only worked if I made the custom user control in a separate project in the solution:
Add new project "Class Library (.NET Framework)"
Add references to System.Windows.Forms & System.Drawing
Add the source of the new user control in the new project
Build the solution
Open the designer
Drag the new user control in the form
In my case the designer automatically added a reference to the new project when I dragged the custom user control in my form.
Hope this help others who stumble upon this question.