@@ -162,7 +162,10 @@ public async override Task GenerateProxyAsync(GenerateProxyArgs args)
162162 private async Task CreateJsonFile ( GenerateProxyArgs args , ApplicationApiDescriptionModel applicationApiDescriptionModel )
163163 {
164164 var folder = args . Folder . IsNullOrWhiteSpace ( ) ? ProxyDirectory : args . Folder ;
165- var filePath = Path . Combine ( args . WorkDirectory , folder , $ "{ args . Module } -generate-proxy.json") ;
165+ var directory = Path . Combine ( args . WorkDirectory , folder ) ;
166+ Directory . CreateDirectory ( directory ) ;
167+
168+ var filePath = Path . Combine ( directory , $ "{ args . Module } -generate-proxy.json") ;
166169 using ( var writer = new StreamWriter ( filePath ) )
167170 {
168171 await writer . WriteAsync ( JsonSerializer . Serialize ( applicationApiDescriptionModel , indented : true ) ) ;
@@ -187,7 +190,7 @@ private async Task GenerateClassFileAsync(
187190 classTemplateEmptyPart . Replace ( NamespacePlaceholder , rootNamespace ) ;
188191
189192 var filePath = Path . Combine ( args . WorkDirectory , folder , $ "{ clientProxyName } .cs") ;
190- Directory . CreateDirectory ( Path . GetDirectoryName ( filePath ) ) ;
193+ Directory . CreateDirectory ( Path . GetDirectoryName ( filePath ) ! ) ;
191194 if ( ! File . Exists ( filePath ) )
192195 {
193196 using ( var writer = new StreamWriter ( filePath ) )
@@ -223,7 +226,7 @@ private async Task GenerateClassFileAsync(
223226 classTemplate . Replace ( $ "{ Environment . NewLine } { Environment . NewLine } { MethodPlaceholder } ", string . Empty ) . Replace ( MethodPlaceholder , string . Empty ) ;
224227
225228 filePath = Path . Combine ( args . WorkDirectory , folder , $ "{ clientProxyName } .Generated.cs") ;
226- Directory . CreateDirectory ( Path . GetDirectoryName ( filePath ) ) ;
229+ Directory . CreateDirectory ( Path . GetDirectoryName ( filePath ) ! ) ;
227230 using ( var writer = new StreamWriter ( filePath ) )
228231 {
229232 await writer . WriteAsync ( classTemplate . ToString ( ) ) ;
@@ -253,7 +256,7 @@ private async Task GenerateClassFileAsync(
253256 interfaceTemplate . Replace ( NamespacePlaceholder , rootNamespace ) ;
254257
255258 filePath = Path . Combine ( args . WorkDirectory , folder , $ "{ appServiceTypeName } .cs") ;
256- Directory . CreateDirectory ( Path . GetDirectoryName ( filePath ) ) ;
259+ Directory . CreateDirectory ( Path . GetDirectoryName ( filePath ) ! ) ;
257260 using ( var writer = new StreamWriter ( filePath ) )
258261 {
259262 await writer . WriteAsync ( interfaceTemplate . ToString ( ) ) ;
0 commit comments