An attempt to attach an auto-named database file **** failed - error-handling

![Item with same name exist or on UNC share][1]
previously i had installed VS - 2015 , but at my institute i created my database in 2013 VS , so VS 15 was not opening the database , so i installed the 2k13, Now after installing ,database gives this error. Kindly help me out.An early response will be greatly appreciated

There's two places you can check to fix this:
In your connectionString in web.config check the connectionString value. In VS2015 the (LocalDb) might have changed so it should be (for VS2015) this:
Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\MyDatabase.mdf;Integrated Security=True
The other place to change is further down in web.config find the entityFramework section and the defaultConnectionFactory and change the parameter to this:
With VS2013 it might have been set to 11.0 in both parts of web.config.
Re-run your application and this should solve the problem. If not post more details about the problem.

Related

Visual studio 2019 Test is failing with error "System.ComponentModel.Win32Exception (0x80004005): This program is blocked by group policy

I had recently upgraded to Visual studio 2019 from 2017. The tests (xunit) was working fantastic until this update. But after updating, when i run my tests it just says "Outcomes Not Run".!!! strange, even it doesn't shows any details of any error under Output window, later found we have to manually change
"Show output from: " drop-down in Output window to "Tests" to see that. I got these details as below
System.Runtime.InteropServices.COMException (0x89710016): Unable to start program C:\Users\bb00001\.nuget\packages\microsoft.testplatform.testhost\16.5.0\build\netcoreapp2.1\x64\testhost.exe.
This program is blocked by group policy. For more information, contact your system administrator.
Since I works in a very restrictive environment, understood i cant run any exes under that location since GP restriction. But got access to particular locations under C Drive.
Is there anyway I can change my testhost.exe file location? which visual studio can pickup the exe from a configured path?
After referring the link https://learn.microsoft.com/en-us/nuget/consume-packages/managing-the-global-packages-and-cache-folders,
I had set an environmental variable like below, where i set a new nuget-package source which my group policy allows me to run applications
This will automatically override the default location to newly setup location. Later restart the visual studio and rebuild the solution, it must add all the dependencies to new location. It worked for me. Not sure this issue will occur to anyone else, but maybe helpful, if someone with need.

Unified primary reference

I am facing issue getting my project to build on server. The same project build fine locally on my machine (VS 2017 15.8). Teamcity sever also has the same msbuild tool version installed. It doesn't have VS 2017.
Project build on server results in following error:
"error CS0433: The type 'OracleCommand' exists in both
'Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral,
PublicKeyToken=89b483f429c47342' and 'Oracle.ManagedDataAccess,
Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342'
So far I have been able to pin point the cause of the error to due to autounify not triggering/working at resolving package reference (I am using package reference for nuget packages) for project build.
I also confirmed that teamcity server doesn't contain Microsoft.NET.Build.Extensions.
Any idea on how shall I proceed towards resolving this issue. I know installing VS 2017 on TC server will likely resolve this, but that's not an option now. Any ideas people?
Here's how I solved the problem on team-city server:
- Copied Microsoft.NET.Build.Extensions folder from my local machine to MSBuild/Microsoft older
- Copied Microsoft.NET.Build.Extensions.targets file to MSBuild\15.0\Microsoft.Common.Targets\ImportAfter folder
Above steps resolved the build issue on TC server.

OPSHUB_ERROR on Migration TFS On Premise to VSTS

I was trying to migrate a VS Project from TFS 2013 on Premise to Visual Studio Team Services. Unfortunately i had an issue:
OH-SCM-009: Error occurred while sync. TF10131: The workspace name
OH_6_14572940012671457294001269-Diego Italo Castillo Castillo87664
contains more than 64 characters, contains one of the following
characters: "/:<>\|*?; or ends with a space. Type a valid name and
try again.
I was trying to migrate a project (Source Code Only) for about 8 hours and i was getting the error in an specific Changueset.
I cant find the real problem.
I Attached logs.
Logs: http://1drv.ms/1paQKu0
Problem Solved. I've changed my credentials Name (Shortly) in my Microsoft Account I was using in order to connect with my VSTS repository.

Error when building and debugging project in Visual Studio: Loading this assembly would produce a different grant set from other instances

I am working on my project in Visual Studio 2013, and vb.net. Everything is fine until today. My computer auto updated itself yesterday and I got this error when I try to debug my project today.
Error 1 The "ResolveComReference" task could not be instantiated from "Microsoft.
Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Loading this assembly would produce a different grant set from other instances. (Exception
from HRESULT: 0x80131401) Proj1
Does anyone know what is causing this error and how can I fix it?
I was facing the same issue. Following are the steps which sorted my issue:
In Website web config file Changed identity impersonate="true" to
identity impersonate="False"
rebuild it & again changed it to identity impersonate="False"
to identity impersonate="True"
Closed the application.
Delete temporary Internet files(V4.0.0.0 as I was using VS 2010).
Restarted IIS.
Opened Application & rebuild it.
Build Succeeded.
Hope it helps.
Check the project references if all exists for the correct version

Cannot open database because of Version error

I am getting the following error when I attempt the following actions in sequence.
Start Debugging.
Log in as a User.
Stop Debugging.
Clean Build
Without closing browser or logging out start Debugging again.
Attempt to Edit or Create or Update some database record.
If the user is not logged in or the browser is closed the error does not occur. I have even upgraded the SQL instance referring this SQL Server: attach incorrect version 661.
The database 'C:\USERS\ME\DOCUMENTS\VISUAL STUDIO 2012\PROJECTS\PROJ1\PROJ1\APP_DATA\ASPNETDB.MDF' cannot be opened because it is version 661. This server supports version 662 and earlier. A downgrade path is not supported.
Could not open new database 'C:\USERS\ME\DOCUMENTS\VISUAL STUDIO 2012\PROJECTS\PROJ1\PROJ1\APP_DATA\ASPNETDB.MDF'. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file C:\USERS\ME\DOCUMENTS\VISUAL STUDIO 2012\PROJECTS\PROJ1\PROJ1\APP_DATA\ASPNETDB.MDF failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
I am testing this on Chrome.
Any Ideas on what area of either MVC Code/ SQL/ Web.Config I should look for to find the cause of this error. I haven't changed the default Membership that is created with VS2012 when you start a new project.