microsoft / microsoft/MSBuildSdks
Can I use the NoTargets SDK to just generate the source?
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 508
- Forks
- 94
- Avg merge
- 6h 40m
- Merged PRs (30d)
- 2
Description
I want to create a project that uses Roslyn Source Generator to generate sources but does not build them.
The purpose is to import the sources generated by this project in another project.
Is this possible?
I wrote the following project and the Generated folder is generated, but the sources are not.
<Project Sdk="Microsoft.Build.NoTargets/3.7.56">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', 'Generated'))</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\MyGenerator\MyGenerator.csproj">
<OutputItemType>analyzer</OutputItemType>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
</Project>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Microsoft.Build.NoTargets/3.7.56 SDK targets and the project XML shown in the issue, then trace how the Roslyn source generator is invoked and how EmitCompilerGeneratedFiles is handled. Done means determining whether this project shape can generate reusable source files without building them, and documenting the required configuration or the limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100