@@ -228,7 +228,8 @@ private IEnumerable<ITaskItem> GenerateCss(SassCompilerOptions options)
228228 }
229229
230230 var hasSources = false ;
231- foreach ( var compilation in options . GetAllCompilations ( ) )
231+ var compilations = options . GetAllCompilations ( ) ;
232+ foreach ( var compilation in compilations )
232233 {
233234 var fullSource = Path . GetFullPath ( Path . Combine ( rootFolder , compilation . Source ) ) ;
234235 var fullTarget = Path . GetFullPath ( Path . Combine ( rootFolder , compilation . Target ) ) ;
@@ -274,15 +275,22 @@ private IEnumerable<ITaskItem> GenerateCss(SassCompilerOptions options)
274275 var generatedFile = new TaskItem ( cssFile ) ;
275276 yield return generatedFile ;
276277 }
277- }
278278
279- private ( bool Success , string Output , string Error ) GenerateCss ( string arguments )
280- {
281- if ( string . IsNullOrWhiteSpace ( TargetFrameworks ) )
279+ // No files reported compiled by dart-sass in stdout but command successful.
280+ // Most likely due to the --update flag and no source changes.
281+ // For a simple source target file scenario always return the target filename to include in MSBuild ContentItems.
282+ if ( compilations . Count ( ) == 1 )
282283 {
283- return CompileCss ( arguments ) ;
284+ var targetFile = Path . GetFullPath ( Path . Combine ( rootFolder , compilations . First ( ) . Target ) ) ;
285+ if ( File . Exists ( targetFile ) )
286+ {
287+ yield return new TaskItem ( targetFile ) ;
288+ }
284289 }
290+ }
285291
292+ private ( bool Success , string Output , string Error ) GenerateCss ( string arguments )
293+ {
286294 var mutexName = GetMutexName ( ) ;
287295
288296 Log . LogMessage ( MessageImportance . Normal ,
0 commit comments