Add a SQL Datasource to a Web Test

2019-03-04 09:22发布

问题:

I am trying to add a SQL Server Data Source to a Web Test in VS2017:

I click Install packages and get this:

Missing option value: installpath

How do I overcome this problem?

Edit 1:

Using Process Monitor I have identified the command VS2017 runs:

"C:\program files (x86)\microsoft visual studio\installer\vs_installer.exe" modify --focusedUi --installPath "" --activityId 6bb6d93d-8c2a-4462-9304-4ef2b29d27d1 --add Microsoft.VisualStudio.Component.SQL.DataSources --includeRecommended

The installPath is empty so I specified it as:

"C:\Program Files x86\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\"

When I specify the installPath I get this error:

System.ArgumentException: The directory path 'C:\Program Files x86\Microsoft Visual Studio\2017\Enterprise\Common7\IDE" --activityId 6bb6d93d-8c2a-4462-9304-4ef2b29d27d1 --add Microsoft.VisualStudio.Component.SQL.DataSources --includeRecommended' is invalid. Parameter name: installationPath

I guessed since its trying to install a Package it must be:

"C:\Program Files x86\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PACKAGES"

That results in this error:

Unsupported option includeRecommended /finalizeinstall

What is the correct command?

Edit 2:

Confirming I already have the DataSources for SQ Server support installed:

Edit 3:

Ok, this is my fault.

I run Visual Studio using a shortcut that uses a junction to avoid the brackets in the path C:\Program Files (x86) in order to connect to an Oracle 9.2 database.

Running Visual Studio (not from the shortcut) I see the dialog and can connect to the Database.

However, when I click OK, no data source is added to the WebTest.

回答1:

This is just a typical day using VS2017. I swear this product has not been properly tested.

So I ran a Process Monitor trace when I clicked the OK button in the Data Connection Dialog and I found one Access Denied:

Event Class:    Registry
Operation:  RegCreateKey
Result: ACCESS DENIED
Path:   \REGISTRY\A\{A8BB3990-53C7-4BD7-A7E3-CFA0DD6BD4EC}\Software\Microsoft\VisualStudio\15.0_8708a912\Data Connection Dialog
TID:    11800
Duration:   0.0000764
Desired Access: Read/Write

I opened Visual Studios own Registry Hive (using these steps) and it turns out the Data Connection Dialog key didn't even exist. I created the Key, closed the registry, re-opened VS2017 and added a DataSource successfully: