Skip to content

Build error when creating source generator for iOS/macOS #159

@Arlodotexe

Description

@Arlodotexe

Current behavior

When creating a blank Uno app with a simple source generator, and referencing it under all heads, the macOS and iOS builds fail with the error message:

"C:\Users\agodfrey\source\repos\test\SourceGeneratorErrorMacOSiOS\SourceGeneratorErrorMacOSiOS.sln" (default target) (1:2) ->
"C:\Users\agodfrey\source\repos\test\SourceGeneratorErrorMacOSiOS\SourceGeneratorErrorMacOSiOS.iOS\SourceGeneratorErrorMacOSiOS.iOS.csproj" (default target) (3:6) ->
(_UnoSourceGenerator target) ->
  MSBUILD : error : Failed to read [C:\Users\agodfrey\source\repos\test\SourceGeneratorErrorMacOSiOS\SourceGenerator\bin\iPhone\Debug\netstandard2.0\SourceGenerator.dll], Could not find a part of the path 'C:\Users 
\agodfrey\source\repos\test\SourceGeneratorErrorMacOSiOS\SourceGenerator\bin\iPhone\Debug\netstandard2.0\SourceGenerator.dll'. [C:\Users\agodfrey\source\repos\test\SourceGeneratorErrorMacOSiOS\SourceGeneratorErrorM 
acOSiOS.iOS\SourceGeneratorErrorMacOSiOS.iOS.csproj]


torErrorMacOSiOS.macOS\SourceGeneratorErrorMacOSiOS.macOS.csproj" (default target) (6:6) ->                                   MSBUILD : error : Failed to read [C:\Users\agodfrey\source\repos\test\SourceGeneratorErrorMacOSiOS\SourceGentorErrorMacOSiOS.macOS\SourceGeneratorErrorMacOSiOS.macOS.csproj" (default target) (6:6) ->  MSBUILD : error : Failed to read [C:\Users\agodfrey\source\repos\test\Source  MSBUILD : error : Failed to read [C:\Users\agodfrey\source\repos\test\SourceGeneratorErrorMacOSiOS\SourceGenerator\bin\iPhoneSimulator\Debug\netstandard2.0\SourceGenerator.dll], Could not find a part of the path'C:\Users\agodfrey\source\repos\test\SourceGeneratorErrorMacOSiOS\SourceGenerator\bin\iPhoneSimulator\Debug\netstandard2.0\SourceGenerator.dll'. [C:\Users\agodfrey\source\repos\test\SourceGeneratorErrorMacOSiOS\SourceGeneratorErrorMacOSiOS.macOS\SourceGeneratorErrorMacOSiOS.macOS.csproj] 

No other project heads have this issue.

Expected behavior

All project heads should build successfully

How to reproduce it (as minimally and precisely as possible)

  1. Download and unzip this premade solution:
    SourceGeneratorErrorMacOSiOS.zip

  2. In a terminal, run msbuild -r. Observe the error message.

  3. Open "SourceGeneratorErrorMacOSiOS.iOS.csproj" and "SourceGeneratorErrorMacOSiOS.macOS.csproj" and on line 5, remove the text OutputItemType="Analyzer" ReferenceOutputAssembly="true" from the source generator's project reference.

  4. Run msbuild -r again. The build is successful.

Workaround

Unknown

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

No response

Affected platforms

iOS, macOS

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

You may need to delete all bin/obj folders between builds if using MSBuild 17.0.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions