发布Asp Net Core项目时缺少编译符号

时间:2018-01-23 08:07:16

标签: asp.net azure asp.net-core visual-studio-2017 asp.net-core-2.0

我最近为我的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

Project Settings

.csproj

Publish Profile Configuration

0 个答案:

没有答案