I've recently noticed that my ..LibraryTests project is not under source control:
When I try to do a checkin (by right clicking on the solution and pressing check in) it says that there are No Pending Changes. It's not seeing changes to the LibraryTests project because it is not under source control.
From my perspective:
The first project is under source control
The second project is not under source control
The solution itself does not seem to be under source control.
How do I get the entire solution including the Tests project checked in?
If you go into Source Control Explorer and navigate to your project you should see that LibraryTests isn't included. Right click on the folder, click on "Add items to folder..." then click on your project folder thats missing. Click next and this should add it to source control.
Related
I want to insert a textbox into a window form so I chose FastColoredTextbox(this). It's a user-control which can be used to make a textblock component that's very similar to the one in a text editor.
I've been trying to get it to work and have done everything I could with my limited knowledge (started winforms a few days ago)
After installing the NuGet package, I tried getting it to work but I am not even able to start. I need help getting started.
I checked if it had the relevant assembly reference and it did.
I expected a component like a button/label to appear in my toolbox which I could drag into my designer but it didn't, so I tried rebuilding and changed settings to see if it appeared in the toolbox as given here. I didn't see anything in the toolbox that I could drag and drop.
I downloaded a sample project and went through the code. The designer.cs file had the variable and code for the textbox. I modified and pasted it into my designer.cs file thinking that it would appear in my designer. Visual Studio gave me a warning that the changes I make in the designer appear here and I shouldn't directly edit it.
There's no documentation to display the textbox. There's documentation for syntax highlighting, code folding etc.
I tried googling "how to use custom user-components" and I got links detialing the process of making a custom component.
If you need anymore details please let me know.
Help is greatly appreciated :)
Since you are using a nuget package (Install-Package FCTB), the control is in this dll:
Solution Directory → packages → FCTB.2.16.11.0 → lib → FastColoredTextBox.dll
You can add the control to Toolbox and drop in on the form and simply assign some text to Text property of control.
To add the control to toolbox, just right click on a group in Toolbox and click Choose Items ..., then from .NET Framework Components tab use Browse... button to choose FastColoredTextBox.dll from this path:
Solution Directory → packages → FCTB.2.16.11.0 → lib → FastColoredTextBox.dll
After choosing the dll, press OK to add FastColoredTextBox control to the toolbox. Then simply drop an instance on form and in code, assign a text to it's Text property:
this.fastColoredTextBox1.Text = "Some Text";
I was having some issue with a relationship not showing up in an the Model Browser for a table. So I deleted it in the EDMX diagram and added it back.
Now I noticed when Checking In Pending Changes, that this same file was marked for deletion and that it is missing the source control padlock icon next to it.
1. I tried File > Source Control > Advanced > Refresh Status to no
avail.
2. The rest of the project is fine...just this one file, so the
source control Bindings check is all ok.
3. I went up to the EDMX file and r-click > Add files to source control..again no luck.
Is there anyway to add this to source control again?
I think you can follow this link on MSDN:
This let you go to Team Explorer => Source Control Explorer => Add Items To Folder => Then Select you .edmx file.
Then that file is included in source control afterwards.
Alternatively, in Check-In Process, check if the file is in the Excluded List at the bottom of that pane.
As pointed out in this SO answer, the Add > Existing item dialog in Visual Studio by default displays the Add button (meaning that the selected items will be physically copied to the new location), whereas the desirable action is often (always?) to Add as Link.
Is it possible to configure Visual Studio so that Add as link is selected by default when opening the Add > Existing item dialog?
I have thoroughly searched the Options dialog in Visual Studio and examined the MSDN documentation for an answer to this, but so far to no avail.
Project Linker would be a good option for automated linking when two new projects are to share the same code base. However, when linking a large number of files from an existing to a new project, one seems to be confined to the Add > Existing item approach, and this work could be much more convenient and less prone to error if Add as link would be the default action.
Unfortunately, there is no option for that. But there is silver lining. You can drag files to a project and drop them to desired folder. Files are copied to your project. If you press Alt key doing drag and drop operation, files are not copied but linked instead.
You can also use VSCommands extension which adds 'Copy as Link' on folders and files in Solution Explorer. After that you can do 'Paste Link' in desired location. It also allows you to navigate to source item from linked item via 'Locate Source File' from cotnext menu. Works with vs2010 and vs2012.
It appears that when you "Add Existing" to a SOLUTION FOLDER(as opposed to an actual folder), then you are always adding these items as a link.
If you add existing items to an actual folder, then you get the button that gives the option for "Add as Link".
Simply Edit project file and change the path of the file.
You can relatively move folder up using ../
It starts in the project folder.
I found an nice tip here:
If you want to add an existing item as link in VS C# Express 2010 in the "Add existing item" dialog you have to explicitly choose Add As Link from the dropdown on the Add button.
I have an existing library (not a Winforms application) that supplies some Winforms to a bona-fide Windows application. Within this library, I would like to create a User Control to group some controls together. To accomplish this, I right-clicked, Add, User Control and dragged some controls onto the new User Control.
So far, so good. The User Control even has the requisite User Control icon. But dragging the new User Control from the Solution Explorer to a new blank Winform does not work (I get a circle with a line through it), and dragging it over to the Toolbox doesn't work either (even though I get a + sign when I drag it over the Toolbox).
Is there some sort of XML magic or something else I'm missing to make this work?
Note: I had some problems with Visual Studio 2008 that I managed to fix by following the workarounds that can be found here. I am now able to get User Controls I added to my existing project into the toolbox by simply rebuilding the project.
Assuming I understand what you mean:
If your UserControl is in a library you can add this to you Toolbox using
Toolbox -> right click -> Choose Items -> Browse
Select your assembly with the UserControl.
If the UserControl is part of your project you only need to build the entire solution. After that, your UserControl should appear in the toolbox.
In general, it is not possible to add a Control from Solution Explorer, only from the Toolbox.
One way to get this error is trying to add a usercontrol to a form while the project is set to compile as x64. Visual Studio throws the unhelpful: "Failed to load toolbox item . It will be removed from the toolbox."
Workaround is to design with "Any CPU" and compile to x64 as necessary.
Reference: https://support.microsoft.com/en-us/kb/963017
I found that user controls can exist in the same project.
As others have mentioned, AutoToolboxPopulate must be set to True.
Create the desired user control.
Select Build Solution.
If the new user control doesn't show up in the toolbox, close/open Visual Studio.
If the user controls still aren't showing up in the toolbox, right click on the toolbox and select Reset Toolbox. Then select Build Solution. If they still aren't there, restart Visual Studio.
There must not be any build errors when the solution is built, otherwise new toolbox items will not be added to the toolbox.
One user control can't be applied to it ownself. So open another winform and the one will appear in the toolbox.
I made a usercontrol in my project, and after building project, I need to put it in my toolbox, and use it as a common control. but i can't. the UserControl is in my project namespace, and I tried Choose Item in right click menu, but I didn't find a way to add it.
I had problems getting them to add automatically to the toolbox as in VS2008/2005.
There's actually an option to stop the toolbox auto-populating!
Go to Tools > Options > Windows Forms Designer > General
At the bottom of the list, you'll find Toolbox > AutoToolboxPopulate which on a fresh install defaults to False. Set it true and then rebuild your solution.
Hey presto, the user controls in your solution should be automatically added to the toolbox.
You might have to reload the solution as well.
Right-click on toolbar then click on "choose item" in context menu. A dialog with registered components pops up. in this dialog click "Browse" to select your assembly with the usercontrol you want to use.
PS.
This assembly should be registered before.
I found that the user control must have a parameterless constructor or it won't show up in the list. at least that was true in vs2005.
Using VS 2010:
Let's say you have a Windows.Forms project. You add a UserControl (say MyControl) to the project, and design it all up. Now you want to add it to your toolbox.
As soon as the project is successfully built once, it will appear in your Framework Components. Right click the Toolbox to get the context menu, select "Choose Items...", and browse to the name of your control (MyControl) under the ".NET Framework Components" tab.
Advantage over using dlls: you can edit the controls in the same project as your form, and the form will build with the new controls. However, the control will only be avilable to this project.
Note: If the control has build errors, resolve them before moving on to the containing forms, or the designer has a heart attack.
I had many users controls but one refused to show in the Toolbox, even though I rebuilt the solution and it was checked in the Choose Items... dialog.
Solution:
From Solution Explorer I Right-Clicked the offending user control file and selected Exclude From Project
Rebuild the solution
Right-Click the user control and select Include in Project (assuming you have the Show All Files enabled in the Solution Explorer)
Note this also requires you have the AutoToolboxPopulate option enabled. As #DaveF answer suggests.
Alternate Solution: I'm not sure if this works, and I couldn't try it since I already resolved my issue, but if you unchecked the user control from the Choose Items... dialog, hit OK, then opened it back up and checked the user control. That might also work.
There are a couple of ways.
In your original Project, choose File|Export template
Then select ItemTemplate and follow the wizard.
Move your UserControl to a separate ClassLibrary (and fix namespaces etc).
Add a ref to the classlibrary from Projects that need it. Don't bother with the GAC or anything, just the DLL file.
I would not advice putting a UserControl in the normal ToolBox, but it can be done. See the answer from #Arseny
In my case, I couldn't see any of the controls in the project. Only when right clicking on toolBox and selecting "Show All" I saw them, but yet they were disabled...
Changing Project type from Windows application to ClassLibrary made the fix.
Basic qustion if you are using generics in your base control.
If yes:
lets say we have control:
public class MyComboDropDown : ComboDropDownComon<MyType>
{
public MyComboDropDown() { }
}
MyComboDropDown will not allow to open designer on it and will be not shown in Toolbox.
Why? Because base control is not already compiled - when MyComboDropDown is complied.
You can modify to this:
public class MyComboDropDown : MyComboDropDownBase
{
public MyComboDropDown() { }
}
public class MyComboDropDownBase : ComboDropDownComon<MyType>
{
}
Than after rebuild, and reset toolbox it should be able to see MyComboDropDown in designer and also in Toolbox
The issue with my designer was 32 vs 64 bit issue. I could add the control to tool box after following the instructions in Cannot add Controls from 64-bit Assemblies to the Toolbox or Use in Designers Within the Visual Studio IDE MS KB article.
Recompiling did the trick for me!
I just had this issue with VS 2022. There may be a quick/easy answer.
My quick and dirty user control would not appear in the toolbox (full rebuild etc.).
I quit the solutiuon and VS, reloaded all, rebuilt and it appeared and worked.