Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DotnetCLI commands not following same behavior as Application #7356

Closed
shairozan opened this issue Jan 5, 2017 · 8 comments
Closed

DotnetCLI commands not following same behavior as Application #7356

shairozan opened this issue Jan 5, 2017 · 8 comments

Comments

@shairozan
Copy link

From @shairozan on January 4, 2017 22:9

Steps to reproduce

Whenever we try to run a migration, it fails, complaining about the secrets.json file not being in the right location. Our DBContext has an onconfiguring override that allows us to select the connection string dynamically based on the environment variables in order to make Docker deployments more fluid.

The biggest issue is that since the 1.1 upgrade, dotnet ef database update has been failing complaining about how secrets.json is not in the bin\Debug\netcoreapp1.1\ directory.

Expected behavior

  1. Override DBContext to select environment based connection string from secrets.json
  2. Run the application this way
  3. Perform EF database updates for migrations
  4. Update database

Actual behavior

The application will run fine, but attempting to perform entity operations like running migrations complains about the secrets.json file not being in the netcore1.1 debug directory

Environment data

$ dotnet --info
.NET Command Line Tools (1.0.0-preview2-003131)

Product Information:
Version: 1.0.0-preview2-003131
Commit SHA-1 hash: 635cf40e58

Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64

Copied from original issue: dotnet/cli#5207

@shairozan
Copy link
Author

From @livarcocc on January 4, 2017 22:47

Can you please move this issue here: https://github.com/aspnet/EntityFramework?

@bricelam
Copy link
Contributor

bricelam commented Jan 5, 2017

Could you share your project.json?

@shairozan
Copy link
Author

{
	"buildOptions": {
		"emitEntryPoint": true,
		"preserveCompilationContext": true,
		"xmlDoc": false,
		"debugType": "portable"
	},
	"dependencies": {
		"DataTables.AspNet.AspNetCore": "2.0.0",
		"DataTables.AspNet.Core": "2.0.0",
		"MailKit": "1.10.1",
		"Microsoft.AspNetCore.Diagnostics": "1.1.0",
		"Microsoft.AspNetCore.Mvc": "1.1.0",
		"Microsoft.AspNetCore.Razor.Tools": {
			"version": "1.0.0-preview2-final",
			"type": "build"
		},
		"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
		"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
		"Microsoft.AspNetCore.Server.Kestrel.Https": "1.1.0",
		"Microsoft.AspNetCore.Session": "1.1.0",
		"Microsoft.AspNetCore.StaticFiles": "1.1.0",
		"Microsoft.EntityFrameworkCore": "1.1.0",
		"Microsoft.EntityFrameworkCore.InMemory": "1.1.0",
		"Microsoft.EntityFrameworkCore.Relational": "1.1.0",
		"Microsoft.EntityFrameworkCore.Sqlite": "1.1.0",
		"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
		"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
		"Microsoft.Extensions.Caching.SqlServer": "1.1.0",
		"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
		"Microsoft.Extensions.Configuration.Json": "1.1.0",
		"Microsoft.Extensions.Logging": "1.1.0",
		"Microsoft.Extensions.Logging.Console": "1.1.0",
		"Microsoft.Extensions.Logging.Debug": "1.1.0",
		"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
		"Microsoft.Extensions.Testing.Abstractions": "1.0.0-preview2-003121",
		"Microsoft.jQuery.Unobtrusive.Ajax": "3.2.3",
		"Microsoft.jQuery.Unobtrusive.Validation": "3.2.3",
		"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
		"NETStandard.Library": "1.6.1",
		"Newtonsoft.Json": "9.0.1",
		"Stormpath.AspNetCore": "0.8.1",
		"Stormpath.SDK": "0.95.0",
		"Stormpath.SDK.Cache.Redis": "0.95.0",
		"Stripe.net": "6.12.0",
		"System.Interactive.Async": "3.1.1",
		"WindowsAzure.Storage": "7.2.1",
		"xunit.runner.console": "2.1.0"
	},
	"frameworks": {
		"netcoreapp1.1": {
			"dependencies": {
				"Microsoft.NETCore.App": {
					"type": "platform",
					"version": "1.1.0"
				}
			},
			"imports": [
				"dotnet5.6",
				"dnxcore50",
				"portable-net45+win8"
			]
		}
	},
	"publishOptions": {
		"include": [
			"wwwroot",
			"Views",
			"Areas/**/Views",
			"appsettings.json",
			"web.config"
		]
	},
	"runtimeOptions": {
		"configProperties": {
			"System.GC.Server": true
		}
	},
	"scripts": {
		"prepublish": [ "bower install", "dotnet bundle" ],
		"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
	},
	"testRunner": "xunit",
	"tools": {
		"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final",
		"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
		"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
		"Microsoft.Extensions.Caching.SqlConfig.Tools": "1.0.0-preview2-final"
	},
	"runtimes": {
		"win10-x64": {},
		"ubuntu.16.04-x64": {}
	}
}

@divega divega added this to the tools/1.0.0 milestone Jan 9, 2017
@bricelam
Copy link
Contributor

@shairozan Does this repro using the latest bits? (See #7358 for how to try them out.)

@shairozan
Copy link
Author

Yeah. Even after updating to 1.1.0-msbuild3-final, the application loads and locates json configurations fine, but dotnet ef complains about not being able to find it.

@bricelam
Copy link
Contributor

Can you share your project (or a simplified repro) so we can investigate further?

@bricelam
Copy link
Contributor

Note, UserSecrets requires updating the call from .AddUserSecrets() to .AddUserSecrets<Startup>().

@bricelam
Copy link
Contributor

Closing since I am not able to repro. Please re-open with a full repro if making the appropriate UserSecrets change doesn't help.

@bricelam bricelam removed this from the tools/1.0.0 milestone Jan 24, 2017
@bricelam bricelam removed their assignment Jan 24, 2017
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants