我最近为我的asp net core项目制作了新的构建配置。当我在本地运行时,一切都有效,但是当我发布到Azure时,我为任何构建配置定义的编译符号都丢失了。我知道这是因为我遇到了下面的NotSupportedException。任何帮助将不胜感激!
#if DB_MEMORY
services.AddDbContext<ClimbContext>(options => options.UseInMemoryDatabase("Test"));
#elif DB_LOCAL
services.AddDbContext<ClimbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("local")));
#elif DB_AZURE
services.AddDbContext<ClimbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("defaultConnection")));
#else
throw new System.NotSupportedException("Need to assign a DB type.");
#endif