hi there i know its most be a silly mistake but i couldn't find it. i add two references to my project by Right click on References and browse them, i simply use component of these Dlls in my program with no problem, auto complete code is work fine for classes of these Dlls. But when i run my program got error like:
The type or namespace name 'GlobalizationDateTimePicker' does not exist in the namespace 'GHDiamond.Windows.Forms' (are you missing an assembly reference?)
for this line in myform.Designer.cs:
this.DateTimePicker_AZ = new GHDiamond.Windows.Forms.GlobalizationDateTimePicker();
References names are: GHDiamond.dll and GHDiamond.Win.dll. they are in Object browser too when a add them, but when i Build my project, GHDiamond.Win is not there anymore ! any help will be appreciated
Select the Reference in the Solution Explorer and go to the property window. Make sure that the property "Copy Local" is set to "True". This causes the dll to be copied to the output directory.
I have had something similar which was caused by missing dependent dlls. Autocomplete worked until i built then i would get a load of compile errors. make sure there are no other dlls that you need.
Related
Please can somebody help.
I have a solution that build locally and on another machine when checked out from Subversion however when I try to build it using the MSBuild tool on my TeamCity server I get some form of assembly referencing problem
[08:33:32][Csc] Controllers\AccountsController.cs(422, 26): error CS1061: 'PF.ENTITIES.PF022.Item' does not contain a definition for 'OperationStatus' and no extension method 'OperationStatus' accepting a first argument of type 'PF.ENTITIES.PF022.Item' could be found (are you missing a using directive or an assembly reference?)
The PF.ENTITIES.PF022 assembly does have the correct property for OperationStatus and as I said it runs fine locally.
Can somebody help?
Thanks
Have you checked if this dll is set as "Copy locally"?
To set the Copy Local property to True or False
In Solution Explorer, click the Show All Files button to display the References node.
Open the References node for the project.
Right-click a reference in the References list, and click Properties.
The properties associated with that reference appear in a list in the Properties window.
Select Copy Local from the left-hand column, and then click the arrow in the right-hand column to change the value to True or False.
https://msdn.microsoft.com/en-us/library/vstudio/t1zz5y8c%28v=vs.100%29.aspx
It was a problem with Project Dependencies.
I wanted to build the whole Solution in TeamCity but I would now advise against this. Rather build individual projects always within the solution, that way you can arrange your build order and set some dependencies (do the same for your CI Deployment System too)
That way you can ensure certainly libraries are in place before you build other projects.
In a solution I am working on, in a sub project I have added a reference to another project. After adding the reference, I was able to successfully add the using statement and have the auto-complete pick up the right extension I was looking for. The code wrote as usual, but when I compiled, I get the error
The type of namespace name 'Name1' does not exist in the namespace 'Name2' (are you missing an assembly reference?)
So I have searched the forums, I have added several other system references and I have gotten nothing. I ran NuGet to update the solution packages, and that didn't make a difference either. For some reason, when I add the reference (using the add reference pop-up GUI) the reference to Name1 doesn't have a dll file in it. If I browse to the dll file directly, it still gives me the same issue when compiling.
Maybe you can copy the dll to [projectname] / Debug /
or [projectname] / Release /
I have a web ASP.NET project with the bellow structure:
I copied this solution to my test computer and now I get
The type or namespace name 'BussinessLib' could not be found
HousingSurvey is the startup project .
Each project get built successfuly but when I try to build the solution I get
The type or namespace name 'BussinessLib' could not be found
As you see BussinessLib is a reference for Housingsurvey. The using BussinessLib statement is set correctly in the HousingSurvey .
So I rebuild BussinessLib and add the reference to Housingsurvey. Housing Survey as a project builds successfully. but again when I build the solution I get The type or namespace name 'BussinessLib' could not be found
To make things stranger when I check
C:\CSharpTest\HousingSurvey\HousingSurvey\BussinessLib\bin\Debug
BussinessLib.dll is deleted somehow(After I build the solution). I double checked BussinessLib.dll and saw it does get created there whenever I build the BussinessLib project.
I found the most promising answer here:
The type or namespace name could not be found
But above answer did not help me since all of 3 projects in my solution are targeted to the .NET Framework 4.5
Any feedback is greatly appreciated.
Update: please note that this whole solution builds "Successfully" in my UAT computer. Then I copy paste it to the test computer and it fails on build.
For some weird reason, whenever I build the whole solution, Business.dll gets deleted from the bin folder! and that's why code that references it can not find it.
From the HousingSurvey Project, delete the reference to BusinessLib and re-add it again. It is probably an issue with a file path for the original reference.
Also when you add the reference to the project again, be sure to set the 'Copy Local' property to True
In Solution Explorer, click the Show All Files button to display the References node.
Open the References node for the project.
Right-click a reference in the References list, and click
Properties. The properties associated with that reference appear in
a list in the Properties window.
Select Copy Local from the
left-hand column, and then click the arrow in the right-hand column
to change the value to True or False.
Error 7 The type or namespace name
'SampleMain' does not exist in the
namespace
'System.Windows.Forms.DataVisualization.Charting.Utilities'
(are you missing an assembly
reference?)
i am getting this error on this line:
System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm mainForm = (System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm)this.ParentForm;
what am i doing wrong?
If you need help figuring out the 'structure' of the namespaces, use the Object Browser from within Visual studio or use Reflector to view what's within the
System.Windows.Forms.DataVisualization.Charting.Utilities
namespace. This may help you gain an understanding as to what you can and cannot access within each.
I get this error when I have no reference to the library in the "References" folder in my project. Check and make sure you are referencing it by clicking on the + next to the References folder and expanding the list.
Some of the libraries require you to explicitly reference them, even if they are contained in a namespace you are already referencing.
Edit: Also, make sure that the namespace/class you are trying to use really exists.
Edit: 'SampleMain' may not even be a good object to use. Found this that suggests that you shouldn't reference sample environment classes: http://social.msdn.microsoft.com/Forums/en/MSWinWebChart/thread/26aac6f7-d3bf-492f-bb52-dc88477f1b1b
Did you add the dll reference to your project?
click on the + next to Reference to see if you have included the correct namespaces/assemblies
You're getting this error because you've referenced a type with the following name that the compiler cannot find
System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm
The most likely causes for this issue are
It exists but it's in a DLL that you haven't referenced in this project. Check the references of the project and make sure the DLL that contains the type is listed
The type name is simply incorrect. Could be a typo or a just a wrong namespace in the name.
The SampleMain type does not exist in System.Windows.Forms.DataVisualization.Charting.Utilities namespace.
Always check that you do not have one of your projects set to the client profile. That will cause this same sort of behavior.
I have a three projects in the solution WinSync. I have WinSyncGui, WinSyncLib and Setup. WinSyncGui requires files from WinSyncLib. How can I get it to include WinSyncLib in WinSyncGui?
VS complains The type or namespace name 'WinSyncLib' could not be found (are you missing a using directive or an assembly reference?)
I've set the dependencies so that WinSyncGui depends on WinSyncLib (so Lib is built first), but it's still not working.
Right click your project (WebSyncGui) and select Add Reference, Projects tab, and then select the project you need to reference.
You need to add WinSyncLib as a reference in your WinSyncGui project.
Adding a project reference.
I've set the dependencies
That sounds wrong. Did you set the "dependencies" or did you set the "references". Dependencies just determine build order, references are used to link projects.
Are you sure all of the types are public? if you omit the modifier, it's internal by default.
Right click on solution, choose Project dependencies and set dependencies whatever you want. It's useful, for example, when you have two exe files in one solution. It's bizzare to add another exe as reference, so I use this option to firstly build depended executable, and then post-build event is copying it into target directory. Very useful toy.