string directoryPath = "<your-directory-path>";
if (!Directory.Exists(directoryPath))
{
Directory.CreateDirectory(directoryPath);
}
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
While deploying DacServices, facing below error
Note: after restarting machine its working fine. Issue occurred intermediate
System.IO.IOException: The directory name is invalid. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.__Error.WinIOError() at System.IO.Path.InternalGetTempFileName(Boolean checkHost) at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.EseManager.CreateInstance() at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.EseManager..ctor(ModelCollation collation, StorageSchema storageSchema, String modelFileName, Boolean createNewModel, List1 elementTables, List
1 annotationTables) at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.ConstructModelStore(ModelCollation collation, String modelFileName, Boolean createNewModel) at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore..ctor(SqlPlatforms platform, ModelCollation collation, ModelSchema modelSchema, String modelFileName, ModelStorageType modelStorageType, Boolean storeSourceCodePositionAnnotations) at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel..ctor(SqlPlatforms platform, ModelCollation collation, ModelSchema storeSchema, String modelFileName, ErrorManager errorManager, ModelStorageType modelStorageType, Boolean storeSourceCodePositionAnnotations) at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlSchemaModel..ctor(SqlDatabaseSchemaProvider databaseSchemaProvider, SqlPlatforms platform, ModelCollation collation, String modelFileName, ErrorManager errorManager, Boolean validationEnabled, Boolean initializeBuiltIns, Boolean validateCasingOnIdentifiers, Boolean convertCrossDbRefToWarning, Boolean isMsdb, ModelStorageType modelStorageType, Boolean storeSourceCodePositionAnnotations) at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlSchemaModelConstructor.ConstructServiceImplementation() at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.ModelContentsState.InitializeModel(DataSchemaModelHeader headerData) at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.DataSchemaModelContentsState.ProcessStartElement() at Microsoft.Data.Tools.Schema.SchemaModel.XmlDeserializerEngine.ReadData(DeserializerState initialState, Boolean keepCurrentReaderPosition) at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.DeserializeXml(TextReader input, ErrorManager errors, String source, Action3 constructorParametersSetter) at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.DeserializePackage(SqlPackage package, ErrorManager errors, Action
3 constructorParametersSetter) at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentEndpointPackage.LoadModel(ErrorManager errors) at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentEndpointPackage.OnLoad(ErrorManager errors, DeploymentEngineContext context) at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment.PrepareModels() at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment.InitializePlanGeneratator() at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment.CreateController(Action1 msgHandler) at Microsoft.SqlServer.Dac.DacServices.CreateController(SqlDeployment deploymentEngine, ErrorManager errorManager) at Microsoft.SqlServer.Dac.DeployOperation.<>c__DisplayClass22_1.<CreatePlanInitializationOperation>b__1() at Microsoft.Data.Tools.Schema.Sql.Dac.OperationLogger.Capture(Action action) at Microsoft.SqlServer.Dac.DeployOperation.<>c__DisplayClass22_0.<CreatePlanInitializationOperation>b__0(Object operation, CancellationToken token) at Microsoft.SqlServer.Dac.Operation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context) at Microsoft.SqlServer.Dac.ReportMessageOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context) at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context) at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context) at Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context) at Microsoft.SqlServer.Dac.OperationExtension.Execute(IOperation operation, DacLoggingContext loggingContext, CancellationToken cancellationToken) at Microsoft.SqlServer.Dac.DacServices.InternalDeploy(IPackageSource packageSource, Boolean isDacpac, String targetDatabaseName, DacDeployOptions options, CancellationToken cancellationToken, DacLoggingContext loggingContext, Action
3 reportPlanOperation, Boolean executePlan, DacTask action, DacPackage dacPackage) at Microsoft.SqlServer.Dac.DacServices.Deploy(DacPackage package, String targetDatabaseName, Boolean upgradeExisting, DacDeployOptions options, Nullable1 cancellationToken) at Import.ImportSQLTask.ImportDacpacFile(DatabaseDetails dbDetail, Boolean includeStagingDb, List
1 preDeployments) in D:\a\1\s\Import\Task\ImportSQLTask.cs:line 74
string directoryPath = "<your-directory-path>";
if (!Directory.Exists(directoryPath))
{
Directory.CreateDirectory(directoryPath);
}
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. In case if you have any resolution please do share that same with the community as it can be helpful to others. Otherwise, will respond with more details and we will try to help.