visual studio does not have System reference - vb.net

i'm using visual studio enterprise 15 on windows 10 on my pc.
in the classes i use system functions without the imports.
for example:
Imports System.Data
Imports System.Data.SqlClient
Imports System.Xml
Imports WebControls
Public Class DataBaseTool
Dim NRnd As New Random
end class
i use Random without System reference.
if i load my project on a my 2nd pc, with visual studio community 15 on windows 7, i must explicit add import System
why?
so, i have more than 100 web pages...i cant't modify all.
thank you!
on win10
on win7
just to be clear, i have the same solution on 2 differents envirorments, but on win10 is fine, on win7 i have the problem with reference.
UPDATE
thanks to all who tried to help me.
i solved creating a new Website solution, then i dragged all files (except for webconfig) and all references are fine.
i don't know why, but it's running.

Open the References page of the project properties and you'll see a section showing the namespaces that are imported project-wide. The top half of the page is the referenced assemblies and the bottom half is the imported namespaces. You can add or remove imports by checking or unchecking items in that list. Anything checked in that list does not need to be imported at the file level.

Related

Is there a way to stop Visual Studio from automatically adding an Imports line when I select a method from the navigation bar?

I'm using Visual Studio 2019 to write some VB code that consumes a couple of webservices. Whenever I select one of the methods from the navigation bar, Visual Studio insists on adding an Imports line at the top of the page. This is very annoying, particularly as there are a couple of structures in each web service with the same name, but different signatures and, because VS has replaced the fully-qualified names when it added the Imports, I'm getting errors.
I've tried manually removing the Imports and re-qualifying all the entries VS has bodged, but it all gets undone if I reselect a web service method from the navigation bar.
I'd prefer VS to leave the fully-qualified object names and not add an Imports line!
You could try an alias for the fully qualified name you wish to use.
Imports a = Fully.Qualified.Name
The in the code
a.MethodName

Adding OpenTK Control to vb.net project

I am experimenting with OpenTK in VB.net using VS 2012. I have used the Nuget manager to include OpenTK and the OpenTK Control in my project. The Imports statement are in place and don't show errors so I assume they items are correctly loaded.
My next step is to add the OpenTK Control to the form. The examples I found on the web use the Choose Items... option found by right clicking the top of the Toolbox Tree. I then use Browse and select the OpenTK control .dll. I then get an error message saying that there is noting in the .dll that can be added to the toolbox.
I'm obviously missing something very basic!
Chris

How do I reference system.drawing in F# source file (fs). It works for script files (fsx)

I'm currently coding in F# using Visual Studio 2015
I'm trying to access the .Net Namespace System.Drawing to make a bitmap. I've been supplied with a working example project from school that draws a bitmap and updates it every second. The file is a F# script file with extension .fsx
The thing is i'm not able to access the System.Drawing namepace and use the same code if I copy and paste it into a F# source file, with the extension .fs.
Visual studio's intellisence is not even showing the .Drawing namespace.
I've tried googling around, but I don't know what to search for.
In Visual Studio
From menu: View -> Solution Explorer
Expand the project. In this example it is ConsoleApplication2
Right click references
Click Add Reference...
On left click Assemblies
Framework should be selected by default. If not select Framework
In upper right for search.
When entering the search term do not press Enter when done.
For search enter: drawing
In middle
Click on System.Drawing
Click box on left of System.Drawing
Click OK
Expand References
Verify reference to System.Drawing added.
In fs file at top add following line
open System.Drawing
You can now use the the library, e.g.
Microsoft notes
For a complete example of creating a project see:
Walkthrough: Using Visual F# to Create, Debug, and Deploy an Application
The part about adding references is under
To develop a component by using F#
and is item 3.
Open the shortcut menu on this project's References node, and then
choose Add Reference. Choose the Solution node, and then choose the
Projects node. Select the check box next to the RateAnalysis project,
and then choose the OK button
.

Namespace cannot be found in one form but it can in others in the same project VB VS2010

I'm having an issue here which I can't resolve. I can't include the namespace which is correct because visual studio correct it into another namespace wich is incorrect. But in other forms in the same project it doesn't have the same behavior.I have checked that my project is configured in .NET 4 and I have restart it and nothing happens. What's going on?
Could you please help me?
Imports ProjectName.BusinessLogicLayer -> This is the correct namespace
Imports Projectname.BusinessLogicLayer -> This is the incorrect
I figured out how to solve my proble with Nidzaaa help! The answer is: Click right on the file->Properties->Build Actions -> Choose Content, not Compile

VB silverlight for windows phone "System.Xml.Linq"

I am having this line in two of my windows phone applications :
Dim doc = XDocument.Parse(e.Result)
in the one of these apps it is working fine , in the other one it seems wrong ...
actually it cant find the object "XDocument"
When i am typing :
Imports System.Xml.Linq
it send me bug a warning :
Warning 2
Namespace or type specified in the Imports 'System.Xml.Linq' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
the only diference between the application that works and the applications that sends me back this bug and this worning is that the one is a simple windows phone page (the working one) and the other one is a panorama page :S
any ideas why i am having this warning ??
thank you
I think you might need to include the reference to System.XML.Linq first using Visual Studios "add reference" command (right click your project node in the project explorer, add reference).