Is there a way to get VS Code to 'Show potential fixes'? - c#

In VS 2017, if I type the following code:
public DateTime birth
{
get;
set;
}
Then I'll get the error:
The type or namespace name 'DateTime' could not be found (are you
missing a using directive or an assembly reference?)
and then if I hover over DateTime a popup appears Show potential fixes and I click using System; and it adds this to the top of the class file and the error is resolved.
Is there a way to get VS Code to Show potential fixes in a similar way? It doesn't currently seem to suggest any potential fixes (I have Omnisharp installed)

As you're refering to missing references you can use this: https://marketplace.visualstudio.com/items?itemName=steoates.autoimport

You should take a look at the VSC Extentions. There might be an extension in there that could help you achieve that same functionality as Visual Studio such as C# or C# Extentions

The following page has different types of formatting extensions you can download for Visual Studio Code: Visual Studio Marketplace

Related

"Storage" does not exist in the namespace "Microsoft.Xna.Framework"

I don't understand why it appears given error : The type or namespace name "Storage" does not exist in the namespace "Microsoft.Xna.Framework" (assembly reference may be missing).
I try to download Microsoft XNA Framework Redistributable 4.0.
How to fix it?
You haven't given any information to your problem such as code you have written or references added so I'm sorry if this doesn't help. But, if you're using Visual Studio 2019 here is a video to help you add the entire framework to your program.
EDIT: If you already have the framework downloaded. What you need to do is right click your project on the right. then Add>Reference.. then search for Microsoft.Xna.Framework.Storage.

The type or namespace 'System' could not be found. Fresh Install of Visual Studio 2017

I've just installed a brand new version of Visual Studio 2017. I attempted to create a new cross-platform app using Xamarin.forms, and I instantly have errors
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) App1.UWP C:...\Visual Studio 2017\Projects\App1\App1\App1\App.xaml.cs 1 Active
I am not sure what to do. I tried restarting- basic things like that. I couldn't get anything to work. Does anyone know why I might not have access to something as simple as System? It says it occurs in the project 'App1.UWP'
Thanks
A random shot in the dark but check the build properties of the file.
If it's a xaml file it should be set to embedded resource otherwise it's set to c# compiler. I had this issue previously where my visual studio for some reason set the build option to none instead of c# compiler or embedded resource.

ASP.Net / C# - missing an assembly reference

Hi, I am a newbie in C# and visual studio. As Figure1 shown, I am trying to use the classes from other project in similar solution.
For example: I try to write "Using LibraryMS.Framework" at UserDto.cs from "LibraryMS.MasterSetup".
And I get the following error message:
"the type or namespace name 'framework' does not exist in the namespace 'LibraryMS' (are you missing an assembly reference?)"
Does anyone know how can I solve this?
Also, do you have any good ASP.net website development online tutorial?
Visual studio version: 2010
.Net Framework 4.0
Thank you.
Its asking you if you missed an assembly reference. So check the references in your class library for LibraryMS.Framework. If you can't find the reference then you can always add it by hitting "Add Reference" then under Reference Manager, click Project and select the class library which you would like to add.
Along these two days, finally I have find out what is going on. The root case is because I am using ASP.NET Empty Web Application instead of using ASP.NET Server Control. Thank you guys. :) now I feel that Programming is a fun thing. Many thx!

Visual studio does not exist in the namespace, but reference is added

I am building a custom code coverage app using the Microsoft.VisualStudio.Coverage.Analysis class.
I have added the reference to the dll to my solution already and when I start typing the using statement at the top of my class Visual Studio is predicting the correct names, e.g. after typing "Microsoft." "VisualStudio" will be displayed in the suggestion box, the same thing happens with the next two levels, Coverage and Analysis.
But the second I try to build the project I get the following error:
the type or namespace name 'visual studio' does not exist in the namespace 'microsoft'
I've no idea why this is happening so any suggestions would be great
I should have checked the warnings in visual studio, they had the real error details, the project had to be built against .net 4.5 and not 4.0.
Once this was changed the project built correctly.

Unable to call method: GetVstoObject

All, Cannot
I have created a Word2007 Document Project and I'm trying to retrieve the content controls on the page via the GetVSTOObject method but it can not find the Microsoft.Office.Tools.Word.Extensions library after I have referenced the Microsoft.Office.Tools.Word.v9.dll as suggested on the MSDN site.
I would greatly appreciate any help.
Below is the error message:
'Microsoft.Office.Interop.Word.Document' does not contain a definition for 'GetVstoObject' and no extension method 'GetVstoObject' accepting a first argument of type 'Microsoft.Office.Interop.Word.Document' could be found (are you missing a using directive or an assembly reference?)
Make sure that you add a using statement for the extensions namespace:
using Microsoft.Office.Tools.Word.Extensions;
If you already did this, can you share the code where you are trying to use the extension method?
Edit:
As you can see in the image you're using Visual Studio 2008 RTM (Release To Manufacturing) version and you have not installed the Visual Studio SP1. The SP1 mentioned in the right is for the .NET Framework.
About Dialog for Visual Studio http://img337.imageshack.us/img337/9041/vs2008sp1.png
Try installing the SP1 for Visual Studio. You can download it from here.

Categories