In our Word 2010 application-level VSTO AddIn
we want to use EF Core to connect to a database. We followed the following official MSDN article for this purpose. But the article is talking about modifying project.json
file that does not exits in a VSTO project. How can we do some tweaking somehow to make EF Core work in a VSTO project - or what are the alternatives (but still using EF Core
)?
Asked
Active
Viewed 537 times
0

nam
- 21,967
- 37
- 158
- 332
-
The use of project.json has already ended, and it's now back to .csproj files. See this answer: http://stackoverflow.com/a/40701486/1220550 – Peter B Dec 28 '16 at 15:19
-
@PeterB My [VSTO](https://msdn.microsoft.com/en-us/library/jj620922.aspx) project does not have a `project.json` file. The link you provided is about migrating `project.json` file to `.csproj` file. In my case what needs to be done? – nam Dec 29 '16 at 00:39
1 Answers
1
I ran into a similar problem when using VS 2017 RC.
VS 2017 RC doesn't create a project.json file any longer so the only way to modify it is to do it through Dependencies - Manage Nuget Packages.
You can just manually add dependencies through the package manager, but make sure you pay close attention to the version numbers.
This does the same thing as editing package.json. I feel like they are giving us less control this way but I would imagine it also protects us from over editing this file.
Hope that helps.

Woot
- 1,759
- 1
- 16
- 23
-
I ran `PM> Install-Package Microsoft.EntityFrameworkCore.SQLite` as suggested by the above mentioned article. And accodding to [this nuget site](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Sqlite/) it automatically installs many dependencies. Do I still need to do anything else? – nam Dec 28 '16 at 15:32
-
1Yeah that will add the depend libraries. They may not show up in your dependency list but they are available to use. I just tried it myself to confirm. The only other thing you might run into is that command for me installed SQLite version 1.1 but my project opened up as .net core version 1.0 so I had to open up package manager and upgrade all my projects to get it to work properly. – Woot Dec 28 '16 at 15:52
-
When I run `dotnet ef migrations add MyFirstMigration` from the [VSTO](https://msdn.microsoft.com/en-us/library/jj620922.aspx) project directory, I get the following error `No executable found matching command "dotnet-ef"`. Everyone I checked online is suggesting some changes to project.json file that does not exists in a VSTO project. – nam Dec 29 '16 at 00:03
-
Yeah in order for that to work you need to install the Microsoft.EntityFrameworkCore.Tools.DotNet package. I would however just use the Microsoft.EntityFrameworkCore.Tools this will allow you to use the Add-Migration -name Initial command. I prefer this because it's closer to EF6 and I think it's the way MS is going with this library – Woot Dec 29 '16 at 11:59
-
I get the error `Install-Package : Unable to find package 'Microsoft.EntityFrameworkCore.Tools'`. Same is true for `...Tools.DoNet` – nam Dec 29 '16 at 15:43
-
1Sorry it's a prerelease packages the install command is Install-Package Microsoft.EntityFrameworkCore.Tools -Pre – Woot Dec 29 '16 at 15:45
-
You made it work for me. Thank you for following along on every step of the process - that others in the context of VSTO would have got confused about. – nam Dec 29 '16 at 16:02
-