refit
refit copied to clipboard
[Bug]: dotnet build with Directory.Build.props can't build source generated code
Describe the bug 🐞
There is an issue when I'm trying to use the file Directory.Build.props with PropertyGroup:
<RootNamespace>$(SolutionName).$(MSBuildProjectName)</RootNamespace>
It's crucial that the building process from the IDE works. However, something goes wrong with the dotnet build command.
When I delete that line from the build props, the build from the PowerShell command line works fine.
Step to reproduce
- Create a project named Worker.
- Create a project named Application.
- Add a reference to the Application project in Worker project.
- In the solution root folder, create a
Directory.Build.propsfile. - Use Visual Studio to build or press F5. The build is successful.
- Go to powershell and use
dotnet build. An error occured
Expected behavior
dotnet build should build as usual build process in IDE.
IDE
Visual Studio 2022
Operating system
Windows
Version
10
Device
Laptop
Refit Version
7.1.2
Additional information ℹ️
Directory.Build.props content:
<Project>
<PropertyGroup>
<RootNamespace>$(SolutionName).$(MSBuildProjectName)</RootNamespace>
</PropertyGroup>
</Project>
Build errors:
Build FAILED.
C:\Users\Sharpzilla\source\MySolution\src\Application\obj\Debug\net8.0\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\PreserveAttribute.g.cs(3,11): error CS1001: Identifier expected
[C:\Users\Sharpzilla\source\MySolution\src\Application\Application.csproj]
C:\Users\Sharpzilla\source\MySolution\src\Application\obj\Debug\net8.0\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\Generated.g.cs(9,14): error CS1001: Identifier expected [C:\Use
rs\Sharpzilla\source\MySolution\src\Application\Application.csproj]
C:\Users\Sharpzilla\source\MySolution\src\Application\obj\Debug\net8.0\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IFreshFitnessApiClient.g.cs(12,14): error CS1001: Identifier ex
pected [C:\Users\Sharpzilla\source\MySolution\src\Application\Application.csproj]
0 Warning(s)
3 Error(s)