Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types Not Generating After Clean and Rebuild (.net 9) #158

Open
thomasreuvers opened this issue Jan 28, 2025 · 1 comment
Open

Types Not Generating After Clean and Rebuild (.net 9) #158

thomasreuvers opened this issue Jan 28, 2025 · 1 comment

Comments

@thomasreuvers
Copy link

Hi Andrew,

First off, thanks for the great library! I'm probably doing something wrong, but for some reason, types aren't being generated in my project. Here's what I'm trying:

Code:

using StronglyTypedIds;

[assembly: StronglyTypedIdDefaults(Template.Guid)]
namespace TemplateBackend.Persistence.Identifiers;

[StronglyTypedId]
public partial struct UserId;

[StronglyTypedId]
public partial struct UserSessionId;

[StronglyTypedId]
public partial struct RoleId;

.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net9.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.1" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.3" />
    <PackageReference Include="StronglyTypedId" Version="1.0.0-beta08" />
  </ItemGroup>

</Project>

After doing a clean and rebuild, no types are generated. I also checked the obj folder but couldn't find any generated files for the types.

Do you have any idea what might be causing this? I’m happy to try debugging further if needed. Thanks in advance for your help!

Best regards,
Thomas

@andrewlock
Copy link
Owner

Hi Thomas, unfortunately I don't have a clue what's going on 😅

I just tried to reproduce this by running dotnet new classlib and copying your files in. I also added the property <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> to the project, so that the files are written to the obj folder, and I can see the expected generated files 🤔

Image

I'm not sure where to go from here unfortunately 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants