while deploying dacpac using dacservice, facing System.IO.IOException: The directory name is invalid

Aleem, Rabiul 0 Reputation points
2025-03-12T08:53:37.9133333+00:00

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, List1 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, Action3 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, Action3 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, List1 preDeployments) in D:\a\1\s\Import\Task\ImportSQLTask.cs:line 74

Azure SQL Database
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. HIMANSHU MAMODIYA 0 Reputation points
    2025-03-12T10:08:54.37+00:00

    string directoryPath = "<your-directory-path>";

    if (!Directory.Exists(directoryPath))

    {

    Directory.CreateDirectory(directoryPath);
    

    }


  2. Mallaiah Sangi 1,145 Reputation points Microsoft External Staff Moderator
    2025-03-18T00:47:43.8633333+00:00

    Hi Aleem, Rabiul

    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.