diff --git a/.editorconfig b/.editorconfig
index 35147d7db8..8469760f15 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -13,7 +13,7 @@ insert_final_newline = true
[*.cs]
indent_size = 4
-dotnet_sort_system_directives_first = true:warning
+dotnet_sort_system_directives_first = true
[*.{xml,config,*proj,nuspec,props,resx,targets,yml,tasks}]
indent_size = 2
diff --git a/NuGet.config b/NuGet.config
index a1f58b6d83..e52b6eb232 100644
--- a/NuGet.config
+++ b/NuGet.config
@@ -4,10 +4,10 @@
-
+
-
+
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 2a3ad1ea19..5ad957a70a 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -1,23 +1,23 @@
-
+
https://github.com/dotnet/arcade
- ac5977ebf05451c1adcf24a15d16263e4d25fd0c
+ f36ea231c234560514ede4c2747897a737ced28f
-
+
https://github.com/dotnet/efcore
- 00e218a90498c21ec14bbaf730a8954c03b42a34
+ 09261bb997c0d82e121cd348d2e43f2b37a65848
-
+
https://github.com/dotnet/efcore
- 00e218a90498c21ec14bbaf730a8954c03b42a34
+ 09261bb997c0d82e121cd348d2e43f2b37a65848
-
+
https://github.com/dotnet/efcore
- 00e218a90498c21ec14bbaf730a8954c03b42a34
+ 09261bb997c0d82e121cd348d2e43f2b37a65848
https://github.com/dotnet/runtime
@@ -27,9 +27,9 @@
https://github.com/dotnet/runtime
-
+
https://github.com/dotnet/aspnetcore
- b6bd3236cda202c27f0f8b40900ba49aa725519e
+ 26e3dfc7f3f3a91ba445ec0f8b1598d12542fb9f
https://github.com/dotnet/runtime
@@ -51,9 +51,9 @@
https://github.com/dotnet/runtime
-
+
https://github.com/dotnet/aspnetcore
- b6bd3236cda202c27f0f8b40900ba49aa725519e
+ 26e3dfc7f3f3a91ba445ec0f8b1598d12542fb9f
https://github.com/dotnet/runtime
@@ -71,17 +71,17 @@
https://github.com/dotnet/runtime
-
+
https://github.com/dotnet/aspnetcore
- b6bd3236cda202c27f0f8b40900ba49aa725519e
+ 26e3dfc7f3f3a91ba445ec0f8b1598d12542fb9f
-
+
https://github.com/dotnet/aspnetcore
- b6bd3236cda202c27f0f8b40900ba49aa725519e
+ 26e3dfc7f3f3a91ba445ec0f8b1598d12542fb9f
-
+
https://github.com/dotnet/aspnetcore
- b6bd3236cda202c27f0f8b40900ba49aa725519e
+ 26e3dfc7f3f3a91ba445ec0f8b1598d12542fb9f
diff --git a/eng/Versions.props b/eng/Versions.props
index 20bec9b826..591790642b 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -12,17 +12,17 @@
$(MicrosoftBuildPackageVersion)
- 7.0.3
+ 7.0.2
- 7.0.3
+ 7.0.2
- 7.0.3
+ 7.0.2
- 7.0.3
+ 7.0.2
@@ -34,7 +34,7 @@
- 7.0.3
+ 7.0.2
@@ -44,14 +44,14 @@
- 7.0.3
+ 7.0.2
- 7.0.3
+ 7.0.2
- 7.0.3
+ 7.0.2
- 7.0.2
+ 7.0.3
rtm
False
true
diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake
index 9646105247..561576be97 100644
--- a/eng/common/cross/toolchain.cmake
+++ b/eng/common/cross/toolchain.cmake
@@ -1,12 +1,5 @@
set(CROSS_ROOTFS $ENV{ROOTFS_DIR})
-# reset platform variables (e.g. cmake 3.25 sets LINUX=1)
-unset(LINUX)
-unset(FREEBSD)
-unset(ILLUMOS)
-unset(ANDROID)
-unset(TIZEN)
-
set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH})
if(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version)
set(CMAKE_SYSTEM_NAME FreeBSD)
diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1
index e10a596879..39be08d4b1 100644
--- a/eng/common/sdk-task.ps1
+++ b/eng/common/sdk-task.ps1
@@ -64,7 +64,7 @@ try {
$GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty
}
if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) {
- $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.4.1" -MemberType NoteProperty
+ $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.3.1" -MemberType NoteProperty
}
if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") {
$xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true
diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml
index 4624885e3b..12a8ff94d8 100644
--- a/eng/common/templates/steps/source-build.yml
+++ b/eng/common/templates/steps/source-build.yml
@@ -63,11 +63,6 @@ steps:
targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}'
fi
- runtimeOsArgs=
- if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then
- runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}'
- fi
-
publishArgs=
if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then
publishArgs='--publish'
@@ -80,7 +75,6 @@ steps:
$internalRuntimeDownloadArgs \
$internalRestoreArgs \
$targetRidArgs \
- $runtimeOsArgs \
/p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \
/p:ArcadeBuildFromSource=true
displayName: Build
diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1
index 021555cf33..4491269432 100644
--- a/eng/common/tools.ps1
+++ b/eng/common/tools.ps1
@@ -365,8 +365,8 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
# If the version of msbuild is going to be xcopied,
# use this version. Version matches a package here:
- # https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-eng&package=RoslynTools.MSBuild&protocolType=NuGet&version=17.4.1&view=overview
- $defaultXCopyMSBuildVersion = '17.4.1'
+ # https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-eng&package=RoslynTools.MSBuild&protocolType=NuGet&version=17.3.1view=overview
+ $defaultXCopyMSBuildVersion = '17.3.1'
if (!$vsRequirements) {
if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') {
diff --git a/eng/common/tools.sh b/eng/common/tools.sh
index e9a7ed9af6..c110d0ed41 100755
--- a/eng/common/tools.sh
+++ b/eng/common/tools.sh
@@ -511,7 +511,7 @@ global_json_file="${repo_root}global.json"
# determine if global.json contains a "runtimes" entry
global_json_has_runtimes=false
if command -v jq &> /dev/null; then
- if jq -e '.tools | has("runtimes")' "$global_json_file" &> /dev/null; then
+ if jq -er '. | select(has("runtimes"))' "$global_json_file" &> /dev/null; then
global_json_has_runtimes=true
fi
elif [[ "$(cat "$global_json_file")" =~ \"runtimes\"[[:space:]\:]*\{ ]]; then
diff --git a/global.json b/global.json
index 0915bbda67..7b57364afc 100644
--- a/global.json
+++ b/global.json
@@ -1,12 +1,12 @@
{
"tools": {
- "dotnet": "7.0.102"
+ "dotnet": "7.0.100"
},
"msbuild-sdks": {
- "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23060.4"
+ "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22561.2"
},
"sdk": {
- "version": "7.0.102",
+ "version": "7.0.100",
"allowPrerelease": true
}
}
diff --git a/scripts/install-aspnet-codegenerator.cmd b/scripts/install-aspnet-codegenerator.cmd
index d6a1ee8f69..53f5973f8a 100644
--- a/scripts/install-aspnet-codegenerator.cmd
+++ b/scripts/install-aspnet-codegenerator.cmd
@@ -1,11 +1,11 @@
-set VERSION=8.0.0-dev
+set VERSION=7.0.3
set DEFAULT_NUPKG_PATH=%userprofile%\.nuget\packages
set SRC_DIR=%cd%
set NUPKG=artifacts/packages/Debug/Shipping/
call taskkill /f /im dotnet.exe
call rd /Q /S artifacts
call build
-call dotnet tool uninstall -g dotnet-aspnet-codegenerator
+call dotnet tool uninstall -g dotnet-aspnet-codegenerator
call cd %DEFAULT_NUPKG_PATH%
call C:
@@ -18,7 +18,7 @@ call rd /Q /S microsoft.visualstudio.web.codegeneration.templating
call rd /Q /S microsoft.visualstudio.web.codegeneration.utils
call rd /Q /S microsoft.visualstudio.web.codegenerators.mvc
call D:
-call cd %SRC_DIR%/%NUPKG%
+call cd %SRC_DIR%/%NUPKG%
call dotnet tool install -g dotnet-aspnet-codegenerator --add-source %SRC_DIR%\%NUPKG% --version %VERSION%
call cd %SRC_DIR%
-call taskkill /f /im dotnet.exe
\ No newline at end of file
+call taskkill /f /im dotnet.exe
diff --git a/src/Scaffolding/VS.Web.CG.EFCore/EntityFrameworkModelProcessor.cs b/src/Scaffolding/VS.Web.CG.EFCore/EntityFrameworkModelProcessor.cs
index f0781e03c2..72d7db81d7 100644
--- a/src/Scaffolding/VS.Web.CG.EFCore/EntityFrameworkModelProcessor.cs
+++ b/src/Scaffolding/VS.Web.CG.EFCore/EntityFrameworkModelProcessor.cs
@@ -10,13 +10,13 @@
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
+using Microsoft.DotNet.Scaffolding.Shared;
+using Microsoft.DotNet.Scaffolding.Shared.Project;
+using Microsoft.DotNet.Scaffolding.Shared.ProjectModel;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.DotNet.Scaffolding.Shared;
-using Microsoft.DotNet.Scaffolding.Shared.ProjectModel;
using Microsoft.VisualStudio.Web.CodeGeneration.DotNet;
-using Microsoft.DotNet.Scaffolding.Shared.Project;
namespace Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
{
@@ -44,7 +44,7 @@ internal class EntityFrameworkModelProcessor
private EditSyntaxTreeResult _programEditResult;
private IFileSystem _fileSystem;
- public EntityFrameworkModelProcessor (
+ public EntityFrameworkModelProcessor(
string dbContextFullTypeName,
ModelType modelTypeSymbol,
string areaName,
@@ -95,7 +95,7 @@ public async Task Process()
{
throw new InvalidOperationException(string.Format(MessageStrings.ModelTypeNotFound, "Program"));
}
-
+
if (!dbContextSymbols.Any())
{
await GenerateNewDbContextAndRegisterProgramFile(programType, _applicationInfo);
@@ -224,8 +224,8 @@ public async Task Process()
}
- public ContextProcessingStatus ContextProcessingStatus { get; private set;}
- public ModelMetadata ModelMetadata { get; private set;}
+ public ContextProcessingStatus ContextProcessingStatus { get; private set; }
+ public ModelMetadata ModelMetadata { get; private set; }
///
/// Writes the DbContext to disk using the given Roslyn SyntaxTree.
@@ -270,9 +270,9 @@ private async Task EnsureDbContextInLibraryIsValid(ModelType dbContextSymbol)
return c;
});
- var dbContextType = _reflectedTypesProvider.GetReflectedType(_dbContextFullTypeName, lookInDependencies:true);
+ var dbContextType = _reflectedTypesProvider.GetReflectedType(_dbContextFullTypeName, lookInDependencies: true);
- if (_reflectedTypesProvider.GetCompilationErrors() != null
+ if (_reflectedTypesProvider.GetCompilationErrors() != null
&& _reflectedTypesProvider.GetCompilationErrors().Any())
{
throw new InvalidOperationException(string.Format(
@@ -299,7 +299,7 @@ private async Task EnsureDbContextInLibraryIsValid(ModelType dbContextSymbol)
private async Task AddModelTypeToExistingDbContextIfNeeded(ModelType dbContextSymbol, IApplicationInfo appInfo)
{
bool nullabledEnabled = "enable".Equals(_projectContext.Nullable, StringComparison.OrdinalIgnoreCase);
- var addResult = _dbContextEditorServices.AddModelToContext(dbContextSymbol, _modelTypeSymbol, new Dictionary { { "nullableEnabled", nullabledEnabled.ToString()} });
+ var addResult = _dbContextEditorServices.AddModelToContext(dbContextSymbol, _modelTypeSymbol, new Dictionary { { "nullableEnabled", nullabledEnabled.ToString() } });
var projectCompilation = await _workspace.CurrentSolution.Projects
.First(project => project.AssemblyName == _projectContext.AssemblyName)
.GetCompilationAsync();
@@ -368,7 +368,10 @@ private async Task GenerateNewDbContextAndRegisterProgramFile(ModelType programT
};
// Validate for necessary ef packages (based on database type)
- EFValidationUtil.ValidateEFDependencies(_projectContext.PackageDependencies, _databaseProvider);
+ if (CalledFromCommandline)
+ {
+ EFValidationUtil.ValidateEFDependencies(_projectContext.PackageDependencies, _databaseProvider);
+ }
// Create a new Context
_logger.LogMessage(string.Format(MessageStrings.GeneratingDbContext, _dbContextFullTypeName));
@@ -438,8 +441,11 @@ private async Task GenerateNewDbContextAndRegister(ModelType startupType, ModelT
Edited = false
};
- // Validate for necessary ef packages (based on database type)
- EFValidationUtil.ValidateEFDependencies(_projectContext.PackageDependencies, _databaseProvider);
+ if (CalledFromCommandline)
+ {
+ // Validate for necessary ef packages (based on database type)
+ EFValidationUtil.ValidateEFDependencies(_projectContext.PackageDependencies, _databaseProvider);
+ }
// Create a new Context
_logger.LogMessage(string.Format(MessageStrings.GeneratingDbContext, _dbContextFullTypeName));
@@ -526,7 +532,7 @@ private ModelMetadata GetModelMetadata(Type dbContextType, Type modelType, Type
{
entityType = dbContextInstance.Model.FindEntityType(modelType);
}
- catch(Exception ex)
+ catch (Exception ex)
{
// We got an exception from the DbContext while finding the entityType.
// The error here is useful to the user for taking corrective actions.
diff --git a/src/Scaffolding/VS.Web.CG.Mvc/Common/CommonCommandLineModel.cs b/src/Scaffolding/VS.Web.CG.Mvc/Common/CommonCommandLineModel.cs
index a4163fa012..1717b65530 100644
--- a/src/Scaffolding/VS.Web.CG.Mvc/Common/CommonCommandLineModel.cs
+++ b/src/Scaffolding/VS.Web.CG.Mvc/Common/CommonCommandLineModel.cs
@@ -20,6 +20,11 @@ public abstract class CommonCommandLineModel
[Option(Name = "useSqLite", ShortName = "sqlite", Description = "Flag to specify if DbContext should use SQLite instead of SQL Server.")]
public bool UseSqlite { get; set; }
+ //adding UseSqlite2 for backwards compat. for VS Mac scenarios (casing issue).
+ [Obsolete("Use --databaseProvider or -dbProvider to configure database type instead")]
+ [Option(Name = "useSqlite", Description = "Flag to specify if DbContext should use SQLite instead of SQL Server.")]
+ public bool UseSqlite2 { get; set; }
+
[Option(Name = "databaseProvider", ShortName = "dbProvider", Description = "Database provider to use. Options include 'sqlserver' (default), 'sqlite', 'cosmos', 'postgres'.")]
public string DatabaseProviderString { get; set; }
public DbProvider DatabaseProvider { get; set; }
@@ -72,7 +77,7 @@ public static void ValidateCommandline(this CommonCommandLineModel model, ILogge
}
#pragma warning disable CS0618 // Type or member is obsolete
- if (model.UseSqlite)
+ if (model.UseSqlite || model.UseSqlite2)
{
#pragma warning restore CS0618 // Type or member is obsolete
//instead of throwing an error, letting the devs know that its obsolete.
diff --git a/src/Scaffolding/VS.Web.CG.Mvc/Controller/ControllerWithContextGenerator.cs b/src/Scaffolding/VS.Web.CG.Mvc/Controller/ControllerWithContextGenerator.cs
index 5f195215f3..8ca2895d9a 100644
--- a/src/Scaffolding/VS.Web.CG.Mvc/Controller/ControllerWithContextGenerator.cs
+++ b/src/Scaffolding/VS.Web.CG.Mvc/Controller/ControllerWithContextGenerator.cs
@@ -64,7 +64,7 @@ public override async Task Generate(CommandLineGeneratorModel controllerGenerato
{
EFValidationUtil.ValidateEFDependencies(ProjectContext.PackageDependencies, controllerGeneratorModel.DatabaseProvider);
}
-
+
string outputPath = ValidateAndGetOutputPath(controllerGeneratorModel);
_areaName = GetAreaName(ApplicationInfo.ApplicationBasePath, outputPath);
@@ -101,7 +101,7 @@ public override async Task Generate(CommandLineGeneratorModel controllerGenerato
if (modelTypeAndContextModel.ContextProcessingResult.ContextProcessingStatus == ContextProcessingStatus.ContextAddedButRequiresConfig)
{
- throw new Exception(string.Format("{0} {1}" ,MessageStrings.ScaffoldingSuccessful_unregistered,
+ throw new Exception(string.Format("{0} {1}", MessageStrings.ScaffoldingSuccessful_unregistered,
MessageStrings.Scaffolding_additionalSteps));
}
}
diff --git a/src/Scaffolding/VS.Web.CG.Mvc/Identity/IdentityGeneratorCommandLineModel.cs b/src/Scaffolding/VS.Web.CG.Mvc/Identity/IdentityGeneratorCommandLineModel.cs
index e5ecfb17d1..6a53a7b440 100644
--- a/src/Scaffolding/VS.Web.CG.Mvc/Identity/IdentityGeneratorCommandLineModel.cs
+++ b/src/Scaffolding/VS.Web.CG.Mvc/Identity/IdentityGeneratorCommandLineModel.cs
@@ -2,6 +2,7 @@
using Microsoft.DotNet.Scaffolding.Shared;
using Microsoft.VisualStudio.Web.CodeGeneration.CommandLine;
+
namespace Microsoft.VisualStudio.Web.CodeGenerators.Mvc.Identity
{
public class IdentityGeneratorCommandLineModel
@@ -13,6 +14,11 @@ public class IdentityGeneratorCommandLineModel
[Option(Name = "useSqLite", ShortName = "sqlite", Description = "Flag to specify if DbContext should use SQLite instead of SQL Server.")]
public bool UseSqlite { get; set; }
+ //adding UseSqlite2 for backwards compat. for VS Mac scenarios (casing issue).
+ [Obsolete("Use --databaseProvider or -dbProvider to configure database type instead")]
+ [Option(Name = "useSqlite", Description = "Flag to specify if DbContext should use SQLite instead of SQL Server.")]
+ public bool UseSqlite2 { get; set; }
+
[Option(Name = "databaseProvider", ShortName = "dbProvider", Description = "Database provider to use. Options include 'sqlserver' (default), 'sqlite', 'cosmos', 'postgres'.")]
public string DatabaseProviderString { get; set; }
public DbProvider DatabaseProvider { get; set; }
diff --git a/src/Scaffolding/VS.Web.CG.Mvc/Identity/IdentityGeneratorTemplateModelBuilder.cs b/src/Scaffolding/VS.Web.CG.Mvc/Identity/IdentityGeneratorTemplateModelBuilder.cs
index 8533ece60d..5ed5691a52 100644
--- a/src/Scaffolding/VS.Web.CG.Mvc/Identity/IdentityGeneratorTemplateModelBuilder.cs
+++ b/src/Scaffolding/VS.Web.CG.Mvc/Identity/IdentityGeneratorTemplateModelBuilder.cs
@@ -53,7 +53,7 @@ public IdentityGeneratorTemplateModelBuilder(
internal string UserClassNamespace { get; private set; }
private Type _userType;
- internal Type UserType
+ internal Type UserType
{
get
{
@@ -182,7 +182,7 @@ public async Task ValidateAndBuild()
{
NamedFiles = _commandlineModel.Files.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
}
- else if(!string.IsNullOrEmpty(_commandlineModel.ExcludeFiles))
+ else if (!string.IsNullOrEmpty(_commandlineModel.ExcludeFiles))
{
string contentVersion;
if (templateModel is IdentityGeneratorTemplateModel2 templateModel2)
@@ -208,7 +208,7 @@ public async Task ValidateAndBuild()
{
throw new InvalidOperationException(string.Join(Environment.NewLine, errors));
}
-
+
//get files to overwrite
NamedFiles = allFiles.Except(excludedFiles);
}
@@ -448,12 +448,12 @@ private bool HasExistingNonEmptyWwwRootDirectory
}
}
- private void ValidateIndividualFileOptions()
+ private void ValidateIndividualFileOptions()
{
//Both options should not be selected. Users should either scaffold a particular set of files OR exclude a particular set of files.
- if(IsFilesSpecified && IsExcludeSpecificed)
+ if (IsFilesSpecified && IsExcludeSpecificed)
{
- throw new InvalidOperationException(string.Format(MessageStrings.InvalidOptionCombination,"--files", "--excludeFiles"));
+ throw new InvalidOperationException(string.Format(MessageStrings.InvalidOptionCombination, "--files", "--excludeFiles"));
}
}
private void ValidateDefaultUIOption()
@@ -462,12 +462,12 @@ private void ValidateDefaultUIOption()
if (IsFilesSpecified)
{
- errorStrings.Add(string.Format(MessageStrings.InvalidOptionCombination,"--files", "--useDefaultUI"));
+ errorStrings.Add(string.Format(MessageStrings.InvalidOptionCombination, "--files", "--useDefaultUI"));
}
- if(IsExcludeSpecificed)
+ if (IsExcludeSpecificed)
{
- errorStrings.Add(string.Format(MessageStrings.InvalidOptionCombination,"--excludeFiles", "--useDefaultUI"));
+ errorStrings.Add(string.Format(MessageStrings.InvalidOptionCombination, "--excludeFiles", "--useDefaultUI"));
}
if (IsUsingExistingDbContext)
@@ -533,7 +533,7 @@ private string GetNamespaceFromTypeName(string dbContext)
private string GetClassNameFromTypeName(string dbContext)
{
- return dbContext.Split(new char[] {'.'}, StringSplitOptions.RemoveEmptyEntries).Last();
+ return dbContext.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries).Last();
}
private void ValidateExistingDbContext(Type existingDbContext)
@@ -669,7 +669,7 @@ private async Task FindExistingType(string type)
Environment.NewLine,
string.Join(Environment.NewLine, _reflectedTypesProvider.GetCompilationErrors())));
}
-
+
}
//get all types and return the one with the same name. There should be no duplicates so only one should match.
return _reflectedTypesProvider.GetAllTypesInProject().FirstOrDefault(
@@ -691,7 +691,7 @@ private void ValidateCommandLine(IdentityGeneratorCommandLineModel model)
}
#pragma warning disable CS0618 // Type or member is obsolete
- if (model.UseSqlite)
+ if (model.UseSqlite || model.UseSqlite2)
{
#pragma warning restore CS0618 // Type or member is obsolete
//instead of throwing an error, letting the devs know that its obsolete.
@@ -710,7 +710,7 @@ private void ValidateCommandLine(IdentityGeneratorCommandLineModel model)
errorStrings.Add(string.Format(MessageStrings.InvalidDatabaseProvider, model.DatabaseProviderString));
errorStrings.Add($"Supported database providers include : {dbList}");
}
-
+
if (!string.IsNullOrEmpty(model.RootNamespace) && !RoslynUtilities.IsValidNamespace(model.RootNamespace))
{
errorStrings.Add(string.Format(MessageStrings.InvalidNamespaceName, model.RootNamespace));
@@ -718,7 +718,7 @@ private void ValidateCommandLine(IdentityGeneratorCommandLineModel model)
if (!string.IsNullOrEmpty(model.Layout) && model.GenerateLayout)
{
- errorStrings.Add(string.Format(MessageStrings.InvalidOptionCombination,"--layout", "--generateLayout"));
+ errorStrings.Add(string.Format(MessageStrings.InvalidOptionCombination, "--layout", "--generateLayout"));
}
if (!string.IsNullOrEmpty(model.BootstrapVersion) && !IdentityGenerator.ValidBootstrapVersions.Contains(model.BootstrapVersion.Trim(' ', '\n')))
diff --git a/src/Scaffolding/VS.Web.CG.Mvc/Minimal Api/MinimalApiGeneratorCommandLineModel.cs b/src/Scaffolding/VS.Web.CG.Mvc/Minimal Api/MinimalApiGeneratorCommandLineModel.cs
index eb1238c560..26c1442b75 100644
--- a/src/Scaffolding/VS.Web.CG.Mvc/Minimal Api/MinimalApiGeneratorCommandLineModel.cs
+++ b/src/Scaffolding/VS.Web.CG.Mvc/Minimal Api/MinimalApiGeneratorCommandLineModel.cs
@@ -28,6 +28,11 @@ public class MinimalApiGeneratorCommandLineModel
[Option(Name = "useSqLite", ShortName = "sqlite", Description = "Flag to specify if DbContext should use SQLite instead of SQL Server.")]
public bool UseSqlite { get; set; }
+ //adding UseSqlite2 for backwards compat. for VS Mac scenarios (casing issue).
+ [Obsolete("Use --databaseProvider or -dbProvider to configure database type instead")]
+ [Option(Name = "useSqlite", Description = "Flag to specify if DbContext should use SQLite instead of SQL Server.")]
+ public bool UseSqlite2 { get; set; }
+
[Option(Name = "databaseProvider", ShortName = "dbProvider", Description = "Database provider to use. Options include 'sqlserver' (default), 'sqlite', 'cosmos', 'postgres'.")]
public string DatabaseProviderString { get; set; }
public DbProvider DatabaseProvider { get; set; }
@@ -66,7 +71,7 @@ public static void ValidateCommandline(this MinimalApiGeneratorCommandLineModel
}
#pragma warning disable CS0618 // Type or member is obsolete
- if (model.UseSqlite)
+ if (model.UseSqlite || model.UseSqlite2)
{
#pragma warning restore CS0618 // Type or member is obsolete
//instead of throwing an error, letting the devs know that its obsolete.
diff --git a/src/Scaffolding/VS.Web.CG.Mvc/RazorPage/EFModelBasedRazorPageScaffolder.cs b/src/Scaffolding/VS.Web.CG.Mvc/RazorPage/EFModelBasedRazorPageScaffolder.cs
index 2a768ce05b..93e7a5a85c 100644
--- a/src/Scaffolding/VS.Web.CG.Mvc/RazorPage/EFModelBasedRazorPageScaffolder.cs
+++ b/src/Scaffolding/VS.Web.CG.Mvc/RazorPage/EFModelBasedRazorPageScaffolder.cs
@@ -137,13 +137,14 @@ internal async Task GenerateViews(RazorPageGeneratorModel razorPageGeneratorMode
}
ModelTypeAndContextModel modelTypeAndContextModel = null;
+ razorPageGeneratorModel.ValidateCommandline(_logger);
string outputPath = ValidateAndGetOutputPath(razorPageGeneratorModel, string.Empty);
if (CalledFromCommandline)
{
EFValidationUtil.ValidateEFDependencies(_projectContext.PackageDependencies, razorPageGeneratorModel.DatabaseProvider);
}
-
+
modelTypeAndContextModel = await ModelMetadataUtilities.ValidateModelAndGetEFMetadata(
razorPageGeneratorModel,
_entityFrameworkService,
diff --git a/src/Scaffolding/VS.Web.CG.Mvc/View/EFModelBasedViewScaffolder.cs b/src/Scaffolding/VS.Web.CG.Mvc/View/EFModelBasedViewScaffolder.cs
index d4e30b745e..ec1962f6ca 100644
--- a/src/Scaffolding/VS.Web.CG.Mvc/View/EFModelBasedViewScaffolder.cs
+++ b/src/Scaffolding/VS.Web.CG.Mvc/View/EFModelBasedViewScaffolder.cs
@@ -6,11 +6,11 @@
using System.IO;
using System.Threading.Tasks;
using Microsoft.DotNet.Scaffolding.Shared;
-using Microsoft.VisualStudio.Web.CodeGeneration;
+using Microsoft.DotNet.Scaffolding.Shared.Project;
using Microsoft.DotNet.Scaffolding.Shared.ProjectModel;
+using Microsoft.VisualStudio.Web.CodeGeneration;
using Microsoft.VisualStudio.Web.CodeGeneration.DotNet;
using Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore;
-using Microsoft.DotNet.Scaffolding.Shared.Project;
namespace Microsoft.VisualStudio.Web.CodeGenerators.Mvc.View
{
@@ -20,7 +20,7 @@ public class EFModelBasedViewScaffolder : ViewScaffolderBase
private IModelTypesLocator _modelTypesLocator;
private IFileSystem _fileSystem;
private bool CalledFromCommandline => !(_fileSystem is SimulationModeFileSystem);
-
+
public EFModelBasedViewScaffolder(
IProjectContext projectContext,
IApplicationInfo applicationInfo,
@@ -29,7 +29,7 @@ public EFModelBasedViewScaffolder(
ICodeGeneratorActionsService codeGeneratorActionsService,
IServiceProvider serviceProvider,
ILogger logger,
- IFileSystem fileSystem)
+ IFileSystem fileSystem)
: base(projectContext, applicationInfo, codeGeneratorActionsService, serviceProvider, logger)
{
_modelTypesLocator = modelTypesLocator ?? throw new ArgumentNullException(nameof(modelTypesLocator));
@@ -60,7 +60,7 @@ public override async Task GenerateCode(ViewGeneratorModel viewGeneratorModel)
{
EFValidationUtil.ValidateEFDependencies(_projectContext.PackageDependencies, viewGeneratorModel.DatabaseProvider);
}
-
+
modelTypeAndContextModel = await ModelMetadataUtilities.ValidateModelAndGetEFMetadata(
viewGeneratorModel,
@@ -68,7 +68,7 @@ public override async Task GenerateCode(ViewGeneratorModel viewGeneratorModel)
_modelTypesLocator,
_logger,
string.Empty);
-
+
await GenerateView(viewGeneratorModel, modelTypeAndContextModel, outputPath);
if (modelTypeAndContextModel.ContextProcessingResult.ContextProcessingStatus == ContextProcessingStatus.ContextAddedButRequiresConfig)
diff --git a/src/Shared/Microsoft.DotNet.Scaffolding.Shared/EFValidationUtil.cs b/src/Shared/Microsoft.DotNet.Scaffolding.Shared/EFValidationUtil.cs
index 1dbc5e51c1..bdd8368bb8 100644
--- a/src/Shared/Microsoft.DotNet.Scaffolding.Shared/EFValidationUtil.cs
+++ b/src/Shared/Microsoft.DotNet.Scaffolding.Shared/EFValidationUtil.cs
@@ -20,6 +20,7 @@ internal static void ValidateEFDependencies(IEnumerable d
throw new InvalidOperationException(
string.Format(MessageStrings.InstallEfPackages, $"{EfConstants.EfDesignPackageName}"));
}
+
if (EfConstants.EfPackagesDict.TryGetValue(dataContextType, out var dbProviderPackageName))
{
ValidateDependency(dbProviderPackageName, dependencies);