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

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,339 questions
0 comments No comments
{count} votes

1 answer

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);
    

    }

    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.