diff --git a/BotProject/Templates/CSharp/BotProject.csproj b/BotProject/Templates/CSharp/BotProject.csproj
index 3cc5c22939..060d2341fe 100644
--- a/BotProject/Templates/CSharp/BotProject.csproj
+++ b/BotProject/Templates/CSharp/BotProject.csproj
@@ -30,7 +30,7 @@
-
+
all
diff --git a/BotProject/Templates/CSharp/Program.cs b/BotProject/Templates/CSharp/Program.cs
index c5869104f3..434f5a21d2 100644
--- a/BotProject/Templates/CSharp/Program.cs
+++ b/BotProject/Templates/CSharp/Program.cs
@@ -24,12 +24,25 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((hostingContext, builder) =>
{
- builder.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
- .AddJsonFile($"ComposerDialogs/settings/appsettings.json", optional: true, reloadOnChange: true)
- .UseLuisConfigAdaptor()
- .UseLuisSettings();
var env = hostingContext.HostingEnvironment;
+
+ builder.AddJsonFile($"ComposerDialogs/settings/appsettings.json", optional: true, reloadOnChange: true)
+ .AddJsonFile("appsetting.json", optional: true, reloadOnChange: true)
+ .UseLuisConfigAdaptor()
+ .UseLuisSettings();
+
if (env.IsDevelopment())
+ {
+ // Local Debug
+ builder.AddJsonFile("appsettings.development.json", optional: true, reloadOnChange: true);
+ }
+ else
+ {
+ //Azure Deploy
+ builder.AddJsonFile("appsettings.deployment.json", optional: true, reloadOnChange: true);
+ }
+
+ if (!env.IsDevelopment())
{
builder.AddUserSecrets();
}
diff --git a/BotProject/Templates/CSharp/Scripts/create.ps1 b/BotProject/Templates/CSharp/Scripts/create.ps1
index 20ca8ddc86..d3ac6cac73 100644
--- a/BotProject/Templates/CSharp/Scripts/create.ps1
+++ b/BotProject/Templates/CSharp/Scripts/create.ps1
@@ -24,9 +24,9 @@ else {
New-Item -Path $logFile | Out-Null
}
-if (-not (Test-Path (Join-Path $projDir 'appsettings.json')))
+if (-not (Test-Path (Join-Path $projDir 'appsettings.deployment.json')))
{
- Write-Host "! Could not find an 'appsettings.json' file in the current directory." -ForegroundColor DarkRed
+ Write-Host "! Could not find an 'appsettings.deployment.json' file in the current directory." -ForegroundColor DarkRed
Write-Host "+ Please re-run this script from your project directory." -ForegroundColor Magenta
Break
}
@@ -152,24 +152,22 @@ if ($outputs)
$outputMap = @{}
$outputs.PSObject.Properties | Foreach-Object { $outputMap[$_.Name] = $_.Value }
- # Update appsettings.json
- Write-Host "> Updating appsettings.json ..."
- if (Test-Path $(Join-Path $projDir appsettings.json)) {
- $settings = Get-Content $(Join-Path $projDir appsettings.json) | ConvertFrom-Json
+ # Update appsettings.deployment.json
+ Write-Host "> Updating appsettings.deployment.json ..."
+ if (Test-Path $(Join-Path $projDir appsettings.deployment.json)) {
+ $settings = Get-Content $(Join-Path $projDir appsettings.deployment.json) | ConvertFrom-Json
}
else {
$settings = New-Object PSObject
}
- $settings | Add-Member -Type NoteProperty -Force -Name 'microsoftAppId' -Value $appId
-
- dotnet user-secrets init --project $projDir
- dotnet user-secrets set "MicrosoftAppPassword" $appPassword --project $projDir
+ $settings | Add-Member -Type NoteProperty -Force -Name 'MicrosoftAppId' -Value $appId
+ $settings | Add-Member -Type NoteProperty -Force -Name 'MicrosoftAppPassword' -Value $appPassword
$settings | Add-Member -Type NoteProperty -Force -Name 'bot' -Value "ComposerDialogs"
foreach ($key in $outputMap.Keys) { $settings | Add-Member -Type NoteProperty -Force -Name $key -Value $outputMap[$key].value }
- $settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $projDir appsettings.json)
+ $settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $projDir appsettings.deployment.json)
Write-Host "> Done."
Write-Host "- App Id: $appId"
@@ -210,4 +208,4 @@ else
Write-Host "+ To delete this resource group, run 'az group delete -g $($resourceGroup) --no-wait'" -ForegroundColor Magenta
Break
-}
\ No newline at end of file
+}
diff --git a/BotProject/Templates/CSharp/Scripts/deploy.ps1 b/BotProject/Templates/CSharp/Scripts/deploy.ps1
index 8d6c86ac60..faab0667c4 100644
--- a/BotProject/Templates/CSharp/Scripts/deploy.ps1
+++ b/BotProject/Templates/CSharp/Scripts/deploy.ps1
@@ -1,4 +1,4 @@
-Param(
+Param(
[string] $name,
[string] $environment,
[string] $luisAuthoringKey,
@@ -56,7 +56,7 @@ if (Test-Path $zipPath) {
dotnet user-secrets init
# Perform dotnet publish step ahead of zipping up
-$publishFolder = $(Join-Path $projFolder 'bin\Release\netcoreapp2.2')
+$publishFolder = $(Join-Path $projFolder 'bin\Release\netcoreapp3.1')
dotnet publish -c release -o $publishFolder -v q > $logFile
@@ -73,26 +73,8 @@ else {
Copy-Item -Path $localBotPath -Recurse -Destination $publishFolder -Container -Force
}
-# Merge from custom config files
-$customConfigFiles = Get-ChildItem -Path $remoteBotPath -Include "appsettings.json" -Recurse -Force
-if ($customConfigFiles) {
- if (Test-Path $(Join-Path $publishFolder appsettings.json)) {
- $settings = Get-Content $(Join-Path $publishFolder appsettings.json) | ConvertFrom-Json
- }
- else {
- $settings = New-Object PSObject
- }
-
- $customConfig = @{ }
- $customSetting = Get-Content $customConfigFiles.FullName | ConvertFrom-Json
- $customSetting.PSObject.Properties | Foreach-Object { $customConfig[$_.Name] = $_.Value }
- foreach ($key in $customConfig.Keys) { $settings | Add-Member -Type NoteProperty -Force -Name $key -Value $customConfig[$key] }
-
- $settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $publishFolder appsettings.json)
-}
-
# Try to get luis config from appsettings
-$settings = Get-Content $(Join-Path $projFolder appsettings.json) | ConvertFrom-Json
+$settings = Get-Content $(Join-Path $projFolder appsettings.deployment.json) | ConvertFrom-Json
$luisSettings = $settings.luis
if (-not $luisAuthoringKey) {
@@ -131,13 +113,17 @@ if ($luisAuthoringKey -and $luisAuthoringRegion) {
$luconfigjson | ConvertTo-Json -Depth 100 | Out-File $(Join-Path $remoteBotPath luconfig.json)
- # Execute lubuild command
- if (Get-Command lubuild -errorAction SilentlyContinue) {
- lubuild --authoringKey $luisAuthoringKey
+ # Execute bf luis:build command
+ if (Get-Command bf -errorAction SilentlyContinue) {
+ $customizedSettings = Get-Content $(Join-Path $remoteBotPath settings appsettings.json) | ConvertFrom-Json
+ $customizedEnv = $customizedSettings.luis.environment
+ bf luis:build --in .\ --botName $name --authoringKey $luisAuthoringKey --dialog --out .\generated --suffix $customizedEnv -f
}
else {
- Write-Host "lubuild does not exist, use the following command to install lubuild:"
- Write-Host "npm install -g https://botbuilder.myget.org/F/botbuilder-declarative/npm/lubuild/-/1.0.3-preview.tgz"
+ Write-Host "bf luis:build does not exist, use the following command to install:"
+ Write-Host "1. npm config set registry https://botbuilder.myget.org/F/botframework-cli/npm/"
+ Write-Host "2. npm install -g @microsoft/botframework-cli"
+ Write-Host "3. npm config set registry http://registry.npmjs.org"
Break
}
@@ -152,8 +138,8 @@ if ($luisAuthoringKey -and $luisAuthoringRegion) {
Set-Location -Path $projFolder
# change setting file in publish folder
- if (Test-Path $(Join-Path $publishFolder appsettings.json)) {
- $settings = Get-Content $(Join-Path $publishFolder appsettings.json) | ConvertFrom-Json
+ if (Test-Path $(Join-Path $publishFolder appsettings.deployment.json)) {
+ $settings = Get-Content $(Join-Path $publishFolder appsettings.deployment.json) | ConvertFrom-Json
}
else {
$settings = New-Object PSObject
@@ -180,7 +166,7 @@ if ($luisAuthoringKey -and $luisAuthoringRegion) {
$settings | Add-Member -Type NoteProperty -Force -Name 'luis' -Value $luisConfig
- $settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $publishFolder appsettings.json)
+ $settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $publishFolder appsettings.deployment.json)
$tokenResponse = (az account get-access-token) | ConvertFrom-Json
$token = $tokenResponse.accessToken
@@ -251,4 +237,4 @@ if ($?) {
else {
Write-Host "! Could not deploy automatically to Azure. Review the log for more information." -ForegroundColor DarkRed
Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed
-}
\ No newline at end of file
+}
diff --git a/BotProject/Templates/CSharp/appsettings.Deployment.json b/BotProject/Templates/CSharp/appsettings.Deployment.json
new file mode 100644
index 0000000000..1797133380
--- /dev/null
+++ b/BotProject/Templates/CSharp/appsettings.Deployment.json
@@ -0,0 +1,3 @@
+{
+
+}
diff --git a/BotProject/Templates/CSharp/appsettings.Development.json b/BotProject/Templates/CSharp/appsettings.Development.json
index e203e9407e..0db3279e44 100644
--- a/BotProject/Templates/CSharp/appsettings.Development.json
+++ b/BotProject/Templates/CSharp/appsettings.Development.json
@@ -1,9 +1,3 @@
{
- "Logging": {
- "LogLevel": {
- "Default": "Debug",
- "System": "Information",
- "Microsoft": "Information"
- }
- }
+
}
diff --git a/Composer/packages/server/src/models/connector/csharpBotConnector.ts b/Composer/packages/server/src/models/connector/csharpBotConnector.ts
index f97dadb2a4..3e8b105a05 100644
--- a/Composer/packages/server/src/models/connector/csharpBotConnector.ts
+++ b/Composer/packages/server/src/models/connector/csharpBotConnector.ts
@@ -152,6 +152,8 @@ export class CSharpBotConnector implements IBotConnector {
`bin/Debug/${envSettings.runtimeFrameworkVersion}/BotProject.dll`,
`--urls`,
this.endpoint,
+ `--environment`,
+ `development`,
...this.getConnectorConfig(config),
],
{