[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Microsoft Visual Studio

806

Solutions

826

Contributors

Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs for Microsoft Windows, as well as web sites, web applications and web services. Visual Studio uses Microsoft software development platforms such as Windows API, Windows Forms, Windows Presentation Foundation, Windows Store and Microsoft Silverlight. It can produce both native code and managed code.

Share tech news, updates, or what's on your mind.

Sign up to Post

I cannot get HttpContext to work in ASP.NET Core.


 public string GetCartId()
        {
            if (HttpContext.Current.Session[CartSessionKey] == null)
            {
                if (!string.IsNullOrWhiteSpace(HttpContext.Current.User.Identity.Name))
                {
                    HttpContext.Current.Session[CartSessionKey] = HttpContext.Current.User.Identity.Name;
                }
                else
                {
                    // Generate a new random GUID using System.Guid class.     
                    Guid tempCartId = Guid.NewGuid();
                    HttpContext.Current.Session[CartSessionKey] = tempCartId.ToString();
                }
            }
            return HttpContext.Current.Session[CartSessionKey].ToString();
        }

Open in new window

 Visual Studio keeps coming back with red squiggly lines under the words HttpContext and the Error message "The name 'HttpContext' does not exist in the current context."

As a bit of background, I'm making two big leaps at once: (a) trying ASP.NET Core for the first time and (b) trying to use C# for the first time after years of just VB/asp.net.  I like a challenge!  To help get me there, I'm using a few online guides:
Getting Started with EF Core on ASP.NET Core with an Existing Database
and
ASP.NET Shopping Cart

In effect, I've followed the first link through from starting a blank project to setting up database CRUD pages and tested - all good.  However, when I insert the shopping basket page from the second link, it errors on anything HttpContext related.

In an attempt to fix this, I've followed the suggestions on  ASP.Net Core Session State, added the relevant code hightighted in yellow for the startup.cs page - but to no avail.
0
I'm trying to investigate a problem with resource files generated by Google Omaha. These resource files contain a place-holder token (%1!s!), which is substituted with branding details during the build process. There are numerous language resource files that contains string tables and this

Here is an example string: "%1!s! some arbitrary text"

Where %1!s! is a place-holder for some substitution text?

My question: is this place-holder substitution mechanism a standard part of the Windows resource file mechanism? If so, can someone please either explain how it works? Where does it get the text used to substitute the place holder? I'm assuming the place-holder works similar to place-holders in printf? If so, how does it know which text token to replace this with? If this is not a standard resource file mechanism, does anyone have a clue as to how Omaha does this during the build process?

Many thanks.

Note: I'm not looking for suggestions to use a different approach. This is how Omaha does it and I just need to understand how this works. Thank you.
0
Hi,

Installed : Visual Studio 2017 Community

When I go to "Source Control Explorer" I cannot add folders or files - "New Folder" and "Add Items To Folder" are both greyed.

I have The correct plug-in selected and The TFS database is created.

Anyone know what I need to do please?
0
Having bought a new machine (running Windows 10 professional) I Have installed the following:

MS Visual Studio 2017 community
MS SQLServer express 2017
Team Foundation Server express 2015

I find that I do the have the option in VS to "Connect to Team Foundation Server"


I have "Visual Studio Team Foundation Server" set as the Source-Control Plug-in.

I can see my server in Source Control Explorer but cannot add folders or items.

If I go into Team Explorer I can see GIT repos   (dunno how to use these) and I can sometimes add a solution to Source control whereby it is visible in Source Control Explorer temporarily.

How can I connect to TFS correctly in VS 2017 Community please?
0
Visual Studio 2005 crystal reports only shows half of print preview, The right half is faded out...
See attached.

Any ideas?
CR-Report.pdf
0
I am new to UWP / XAML / WPF / Windows Store apps.  I am running Windows 10.

Is the ApplicationFrameHost a process that is responsible for running Universal Windows apps?  Does the debugger make use of it?

If there are no UWP apps running, in the debugger or otherwise, should this process still be running?

If I am running a UWP app in the Visual Studio 2015 Community debugger and I close the app - why does it take like ... 10 to 15 seconds for the debugger to stop?  Is that normal?
0
In an Xamarin Forms project under Visual Studio 2017, I can't get the FCM (Firebase Cloud Messaging) token for Android devices (.Droid project) to register it to FCM.

I created an application on the Firebase console, and retrieved the ApplicationId, ApiKey, ProjectId and GcmSenderId.

Here is the code I use in the .Droid project on Xamarin.Forms:

var options = new FirebaseOptions.Builder()
                    .SetApplicationId("xxxx")
                    .SetApiKey("xxxxxxxxxxxxx") 
                    .SetProjectId("xxxxxxxxx")
                    .SetDatabaseUrl("xxxxxxxxxxxxxxx")
                    .SetGcmSenderId("xxxxxxxxxxxx")
                    .Build();

FirebaseApp app = FirebaseApp.InitializeApp(Android.App.Application.Context, options);
String token = FirebaseInstanceId.Instance.Token; // RETURNS NULL
String authorizedEntity = "xxxxxxxxxx";
String scope = "GCM";
String token2 = FirebaseInstanceId.Instance.GetToken(authorizedEntity, scope); // ALSO RETURNS NULL

Open in new window


I do not understand why the GetToken () function returns NULL.
Can you help me please ?

For the UWP project, I can recover it by the following method:
var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync ();
String Token = channel.Uri;

I followed this doc:
https://docs.microsoft.com/fr-fr/azure/app-service-mobile/app-service-mobile-xamarin-forms-get-started-push
0
I need to change a gridview datasource/connectionstring based on session parameter/login.

Just a little background, we have an in-house software that generates an .mdb database file and then uploads it to our hosted database-driven website via FTP. Each of our customers get their own .mdb file and a login to the website. The website is designed to show only their assigned .mdb. But the website has limited capabilities.

So I was tasked to update the website and found out that it uses .asp, but I am not well versed in VB script and found that creating an .aspx web application is easier.

Now I'm developing a web application in Visual Studio that utilizes the same database but with added features such as sorting, paging, and filtering based on keyword searches.

I've finished creating the login part (with sessions), and I've been able to create a page that displays data on a gridview. My problem now is that I don't really know how to change the gridview datasource based on login/session.

By the way, the database for login information is also an .mdb and is also uploaded by our in-house software. If we need to add new users, we use the in-house software to update the .mdb and then upload it to the website. There are 3 columns in the database table, username, password, and client code. I would like to use the client code to pull the correct database file because each of the database files contain a specific client code already.

Please assist. Thanks!
0
I have an ASP.net core web application developed in visual studio 2017. On running the application, this error pops up "unable to launch web server iis express". I have tried the following things :

  • Delete applicationhost.config file and restart visual studio
  • Change the port and run the application again
  • Restart visual studio and run in administrator mode
  • Restart the system

None of the above solutions works for me. It will be really appreciated if someone can help.
0
Trying to create a Dynamics 365 package in Visual Studio.  Error when select to create.  Add the project types from the Dynamics 365 SDK.  All seemed to go ok.  Can't get passed the error on create.  Any help appreciated.  Larry
2
Trying to update visual studio 2015 to include xamarin.

However, it keeps getting stuck on Applying: Windows Software Development Kit for Windows Store Apps

For instance, it's now been running 24 hours and is still in the same status it was when I left it yesterday.

I have done a control alt delete into a shutdown (not in hibernate shut down with quick startup, but a true shut down).

And tried it again. Same thing repeatedly after about 5 tries.

I have done a rollback to 2 and then 3 days ago, but my rollbacks always fail. 3 rollbacks and after I restart and work for around 10 minutes, then it indicates the rollback failed.

I have even done the rollback restart and waited without touching anything and it fails.

So there is no rolling back.

however, my VS works fine and I can use it. I just can't install Xamarin.

We have now tried this on two different computers with the exact same results. We are on wired internet Google Fiber  with a download speed of 920 mbps and upload of 909 mbps, so it's not bad internet.

Both computers are nice computers. This one has 32 GB RAM only using 4% cpu and 20% memory. Windows 10 Pro, 64-bit.

Thanks!
0
I am trying to create a method which can retrieve JSON objects.  I’m using the Jama API (https://dev.jamasoftware.com/rest)
To simplify it I am using RestSharp
I start by using the Jama swagger tool to test the interface.  This produces a Response Body.  I take this response body and in visual studio create a new class using the paste special ‘paste JSON as classes’ command.

This results in a new class:

public class Item
    {

        public class Rootobject
        {
            public Meta meta { get; set; }
            public Links links { get; set; }
            public Datum[] data { get; set; }

            public static explicit operator Rootobject(List<object> v)
            {
                throw new NotImplementedException();
            }
        }

        public class Meta
        {
            public string status { get; set; }
            public DateTime timestamp { get; set; }
            public Pageinfo pageInfo { get; set; }
        }

        public class Pageinfo
        {
            public int startIndex { get; set; }
            public int resultCount { get; set; }
            public int totalResults { get; set; }
        }

        public class Links
        {
            public DataFieldsLookup5 datafieldslookup5 { get; set; }
            public DataLockLockedby datalocklockedBy { get; set; }
            public DataFieldsLookup6 datafieldslookup6 { get; set; }
            public DataFieldsLookup3 datafieldslookup3 { get; set; }
        

Open in new window

0
I wish I could find simple example C++ code to read a JPG file from the disk and put it in the clipboard.
Windows, MFC, VS2017.
0
We have a VDI environment that was running visual studio 2015 on the VMs. The VMs never complained about reactivation of trials running out after activation. I assume they are utilizing the KMS servers but I am not 100% clear. I have only some basic install experience with VS so wanted some clarification.

1. Does Visual Studio 2017 utilize a KMS server for licensing?

2. if #1 is false, does every user who is using VS need an individual MSDN account?


Our Vendor VDI Environment did not have any of the users licensed through MSDN. Not sure if this is something we missed. It now or at least seems we should have always had our Vendors who are utilizing VS with a valid MSDN account.

any clarification would be helpful.
0
I'm writing a COM component, basically an enumerable class (so I can use the for .. each loop from VBA).

I managed to write the Following wich work:
<ComClass(FieldValidators.ClassId, FieldValidators.InterfaceId, FieldValidators.EventsId)>
Public Class FieldValidators
    Implements IEnumerable

#Region "GUID COM"
    Public Const ClassId As String = "2d368af9-55a7-4cca-a79d-06b6c3a91554"
    Public Const InterfaceId As String = "5094acfa-2799-491d-b7f0-ebc4a2d0e755"
    Public Const EventsId As String = "a31bb5c3-99c6-4548-85cc-fbe83d407867"
#End Region

    Private mFieldValidators As List(Of IFieldValidator)

    Public Sub New()
        MyBase.New()
        mFieldValidators = New List(Of IFieldValidator)
    End Sub

    Protected Overrides Sub Finalize()
        mFieldValidators = Nothing
        MyBase.Finalize()
    End Sub

    Public Sub Add(ByRef validator As IFieldValidator)
        mFieldValidators.Add(validator)
    End Sub

    Public Function Count() As Long
        Count = mFieldValidators.Count
    End Function

    Public Iterator Function GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
        For Each fieldValidator In mFieldValidators
            Yield fieldValidator
        Next
    End Function

    Default Public ReadOnly Property item(ByVal index As ULong) As IFieldValidator
        Get
            item = mFieldValidators(index)
        End Get
    End Property
End Class

Open in new window

But the resulting enumerator is poorly typed (IEnumVARIANT), I would like to return objects of type IFieldValidator.

Is it doable ?
0
Currently I have built an application (using Visual Studio .Net MVC Web Application in C#) which opens up specific views in Sage 300, which I then use to pull specific table information. I am currently trying to get Quantity on Hand data (the number) from Sage 300's IC0290 ROTO ID View. The code I have will only bring back "0". It does bring back other information from the same table as long as the values for that information are strings. The value type for QTYONHAND is BCD*10.4 . I am trying to use Decimal in C# but it brings back a 0. I have the code listed below. If anyone has any ideas on how I can get the actual data to come through, I would greatly appreciate it.

private void OpenSessionDBandView()
    {
        // Create, initialize and open a session.
        session = new Session();
        session.Init("", "XY", "XY1000", "62A");
        session.Open("ADMIN", "ADMIN", "SAMINC", DateTime.Today, 0);

        // Open a database link.
        mDBLinkOpen = session.OpenDBLink(DBLinkType.Company, DBLinkFlags.ReadWrite);

        // Open the I/C Items View - "IC0310"
        icItemView = mDBLinkOpen.OpenView("IC0310");

        // Open the I/C Items View (Quantities on Hand) - "IC0290"
        icLocationDetailsView = mDBLinkOpen.OpenView("IC0290");
    }
    public string DoIt()
    {
        string returnHTML;

        OpenSessionDBandView();

        decimal itemQoH;
        // "itemNumber" is a value derived from a form created. User submits …
0
I have a silverlight app hosted on windows 7 and IIS, it works fine

I'm trying to move to a different box (windows 10) and its not working
I've run fiddler tool and can see the SVC binary requests are not found (404)
As this is a direct copy of the published code, I assume its setup related
If i run the project through visual studio it works fine, but in IIS does not

Here is an example of the url that isn't found on the new box:
http://localhost/MasterUI/ClientBin/MasterUI-Web-GuiViews.svc/binary/GetV_gui_TempAlarmGraph_by_Site?site=0001&ent=FFFFFFFF
The above gives a 404 in fiddler

The previous request to the XAP file works and does NOT 404
http://localhost/MasterUI/ClientBin/MasterUI.xap

I've tried to duplicate the IIS setup as much as possible, but for some reason it isn't working

My solution consists of 2 projects
MasterUI (silverlight stuff here)
MasterUI.Web (this is the non silverlight app - .aspx files)


The windows 10 box is a fresh install, so perhaps i'm missing some components, but as its working in visual studio on this windows 10 box, I assume it's IIS setup related?
0
Hi, I use Visual Studio 2017 (C#) and have installed  Windows SDK 10.0.17134.12
I cannot create 64-bit application , I changed everything I found in settings for project to 64 and
still when I use Advanced Installer and InstallShield my program installs in Program Files(x86)
What else I can do ? all information I found on Microsoft just going around and don't give the clear
step by step information.
I use 64 bit Windows 10 for development.
0
Hello,

I am getting below error while connecting Oracle DB from Visual Studio 2015 - SSIS. Can you help me to fix below error?
MS SQL Version: MS SQL 2016 Ent Edition
Oracle client version: Oracle 11g 64 bit (Oracle Database 11g Release 2 Client (11.2.0.1.0) for Microsoft Windows (x64) )
ODAC version: ODAC 11.2 Release 5 and Oracle Developer Tools for Visual Studio (11.2.0.3.20) (32 bit)

I have also tried with 64-bit ODAC 12.2c Release 1 (12.2.0.1.1) for Windows x64, but still same error. There are No multiple 32-bit client libraries (SQAORA32.dll) on the same machine.

I am able ro connect oracle DB using SQL plus utility but geeting error in SSIS.
0
Hi,

I'm trying to build a simple COM component (class Library) usable with from VBA, but so far it isn't working as expected (I recieve a DLL loading error whenever I try to add a reference).

I'm using Visual Studio Community 2017 / Visual BAsic.Net /  .Net Framework 4.6.1, the source code compile, the COM component is Registered, but no way to add a reference to it.
What did I miss ?

For record, here is the source code:
<ComClass(ComClass1.ClassId, ComClass1.InterfaceId, ComClass1.EventsId)> _
Public Class ComClass1

#Region "GUID COM"
    ' Ces GUID fournissent l'identité COM pour cette classe 
    ' et ses interfaces COM. Si vous les modifiez, les clients 
    ' existants ne pourront plus accéder à la classe.
    Public Const ClassId As String = "2f55bb60-0e65-4056-b6cb-d4883b531da6"
    Public Const InterfaceId As String = "5fdb7171-a274-4ee8-94b9-4346050233f5"
    Public Const EventsId As String = "b451bac4-a9b5-4874-bc36-e292dfdf33c5"
#End Region

    ' Une classe COM pouvant être créée doit avoir Public Sub New() 
    ' sans paramètre, sinon, la classe ne sera pas 
    ' inscrite dans le Registre COM et ne pourra pas être créée 
    ' via CreateObject.
    Public Sub New()
        MyBase.New()
    End Sub

    Public Function getValue() As String
        getValue = "bla blah"
    End Function

End Class

Open in new window

0
I have an Azure web site, circleahotshot.com, that was built using Visual Studio 2017 on a Windows 10 computer. When I access the web site from Firefox of IE on a Windows 10 pc, all is well. When I try to access the web sire on a windows 7 computer with either Firefox or IE I get a "404 Web Site not found" error. The Windows 7 computer has a 32-bit OS where the Windows 10 has a 64-bit os.
0
Published iOS app about 18 months ago using Xamarin Studio.  Now that its Visual Studio 2017, need to recreate Apple certificates and profiles and then use fastlane to install them on my Mac.  App builds fine and it runs on an iPhone attached to my Mac.  Looking for a consultant who can help me with this process.
0
I'm having an issue previewing my changes before publishing my code.   When I click "Start Preview" I'm getting the following error:

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

Pretty vague.  What File name?  I did a Google search on the error and the results returned are from users having issues Publishing their solution.  I can publish the solution without error.  It's the "Start Preview" that fails.  

It's also a random error.  Sometimes it happens and sometimes the Preview works.

Any suggestions?
0
I am installing Visual Studio 2015 professional edition on my laptop, but getting setup failed errors.
Attached is the screenshot of failed setup errors and warnings.
Please let me know how I can prevent these errors and install it successfully.
SS1.jpg
0

Microsoft Visual Studio

806

Solutions

826

Contributors

Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs for Microsoft Windows, as well as web sites, web applications and web services. Visual Studio uses Microsoft software development platforms such as Windows API, Windows Forms, Windows Presentation Foundation, Windows Store and Microsoft Silverlight. It can produce both native code and managed code.