I am on .NET Framework 4.0, building a C# web application in VisualStudio 2012. I have Microsoft.VisualBasic added as a reference to the project. I am having trouble with the following line of code:
using Microsoft.VisualBasic.FileIO;
Building the solution returns the error: The type or namespace name 'FileIO' does not exist in the namespace 'Microsoft.VisualBasic' (are you missing an assembly reference?)
I have removed and re-added the reference to the assembly Microsoft.VisualBasic, but still get the error. Microsoft.VisualBasic is in the GAC, as well as Microsoft.VisualBasic.Compatibility, Microsoft.VisualBasic.Compatibility, Microsoft.VisualBasic.PowerPacks.Vs, and Microsoft.VisualBasic.Vsa.
Please let me know how to get VS2012 to recognize the FileIO namespace.
Right-click on your project and select Add Reference...
In the Reference Manager, expand Assemblies and select Framework. Then check the box for Microsoft.VisualBasic and click OK.
I had similar issue, fixed by change TargetFramework (in .csproj) from netstandard2.0 to netcoreapp3.0.
Application references are not available to uncompiled files in your application (aspx, ashx). There are two solutions to this issue as follows:
1) Move your code to a compiled part of the application (cs/vb file)
or
2) Add the reference to the web config
My reference was in an ashx file. I simply copied the code from the ashx file to the clipboard, deleted the file from the project, added a new Generic Handler (right click in Visual Studio > Add > Generic Handler), entered the same name as before, and pasted the code from the clipboard into the cs file editor that Visual Studio opened. I now have a cs file that will compile with the project and use the project reference. The file name is the same, so there is no need to update anything else -- just rebuild and deploy.
Related
Other Resources Checked/ Ideas tried
Don't understand why we're getting error CS0234
Type or namespace name does not exist
Cleaning the solution then rebuilding.
Removing the obj and bin folders completely for both projects.
Setup
Visual Studio 2015 update 3
.net 4.5
I currently have a solution with 2 projects. 1 project has a direct reference to the other project, they are both .net 4.5. For simplicity, I will call the project that is being referenced 'A', and the project that is referencing A - 'B'.
While developing in B I have full IntelliSense on classes within A. As soon as I build the solution, project A builds successfully, but project B has several errors as such:
The type or namespace name 'x' does not exist in the namespace
'projectName' (are you missing an assembly reference?)
When I double click the error to navigate to the file I see the error on the 'using' statement for about 1 second, then it disappears along with the error from the error list. I can continue clicking through the entire error list until the error list is empty, but as soon as I rebuild the errors reappear.
Any help would be greatly appreciated.
Verify if project B is referencing other dll files that use a higher Framework version than 4.5, also, I have experienced this problem due to some Nuget packages that had to be added in every project that referenced the original one using the package.
Try taking a look at your Project Dependencies. To do this:
Right Click on your Solution and select Properties
Then on the left side of the screen select 'Project Dependencies'
Make sure that Project 'B' depends on Project 'A'.
This will assure that the projects are being built in the correct order. It should already be set this way, but sometimes Visual Studio doesn't set the dependencies up correctly.
Also, make sure that you don't have any references to Project 'A' in Project 'B'. That would create a circular dependency and give you no end of grief.
do you have a file reference or a project reference. If its a file reference (ie you pointed at the output dll of project A) then you need to ensure that the project dependencies say that B depends on A so that they get built in the correct order
So, I'm working with a Solution, Solution. I have a project that I use as a library, Library. It's located in a dir outside of Solution.
I did the following:
Inside the Solution root directory I created a hard link (mklink /J), Link, to the path for Project.
I added Project to Solution using the Link as the address, generating a
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project", "Link\Project.csproj", "{1DE7E580-A7EB-4228-AA72-2110FE7881DD}"
EndProject
line in the Solution.sln file
Added Project, as a reference, into another project Project2 that lives inside Solution
However, the library shows up with a File Not Found icon in the references list:
If I include the namespace in a file I get:
Error 23 The type or namespace name 'InvoiceGeneratorLib' could not be found (are you missing a using directive or an assembly reference?)
Is VS unable to follow hard-linked project references? What else could be causing trouble?
Hard-to-spot mistake.
The reason the Proeject dll was not being added the Project2 is because
Project was targeting .NET 4.5.2
and
Project2 was targeting .NET 4.5
At least, I can say that TIL that you can use a hard-link to add a project to more than one solution. Not sure if this is best practice, but there it is...
I'm trying to use Telerik with .NET framework 3.5 and Visual Studio 2008
I installed Telerik Reporting but when I try to use Telerik.Reporting I get error:
The type or namespace name 'Reporting' Doesn't exists in namespace 'Telerik' (are you missing an assembly reference?)
How can I solve this?
EDIT
I tried to add Reference but it prevents to be added (path is empty):
You need to add Telerik.Reporting.dll in References like following image:
Make a folder name Dependents and copy these files to this folder :
Telerik.Reporting
Telerik.ReportViewer.WebForms
Telerik.Web.UI
Now click on References and then navigate to Add Reference and then a window will open. Browse to Folder Dependents and add all these dlls. Once dlls are added right click on them and make sure thier property Copy Local is set to True.
Add Refrences
Select dlls from Folder. Please note you can have any name to this folder. This is just for the reason if you miss any references in the future you can add them again from this folder inside your project.
Right click to referenced dll and navigate to property here you can define copy local to true.
I have created a project library dll and it resides in the bin directory of the solution. I've got a second solution that references that dll. In the VS2013 IDE my 'Using' directive is happy and down n the code when I reference a class in the dll the code is happy. If I view the object reference in the object browser all look ok. I've also looked in the csproj file and the correct reference is in there. When I try to build the project I receive the type or namespace for my dll could not be found error message. I've tried cleaning first, I've also closed VS2013 and restarted all to no avail. I've also tried copying the dll to the local bin directory for this solution and re-referencing and still no joy
Ok, I found the solution. The project that I am referencing is targeting .net4.5.2 of the framework. THe project that was referencing it was only referencing .net4.5 I have set this to .net4.5.2 and it now builds.
Thanks
For all the input
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 /