-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Scaffolding doesn't work with the latest version of Mono.TextTemplating #32385
Comments
Same here. I am using postgresql. |
@risperdal Please post your csproj file. |
hello, I have the same problem. the content of my csproj file is as follows. I would be grateful if you can help what we need to do. |
@akinsoftyazilim42 You are not using the version 8 packages: <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9">
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" /> |
I'm very sorry. I had taken it back. Now I'm sending you the problematic version. |
@akinsoftyazilim42 Remove |
We uninstalled the Npgsql.EntityFrameworkCore.PostgreSQL.Design package, but the error still persists. |
yes. i tried it and now i get the same error. |
Same error here, without using any PostgreSQL libraries.
Attached is my .csproj-file: Projectfile.zip |
Have you tried with a clean set of the latest t4 templates? |
I did, I didn't use templates before (didn't need it) so they are the latest. The DbContext.t4 starts (after the imports) with
|
Thanks for info. ;) |
you are welcome |
Thanks for the information, but it didn't work for me. |
@bricelam Can you take a look at this? |
Removing the reference to Microsoft.VisualStudio.Web.CodeGeneration.Design fixed it for me. |
Note for triage: I suspect the issue here is that VS package is bringing Mono.TextTemplating 2.3.1, but EF seems to require 2.2.1. |
…lternate key property Fixes #28961 Reverts #30213 for #32385 In #32385, an unconstrained alternate key was added to the model purely to make a non-identifying relationship artificially identifying. #30213 attempted to fix this by throwing that the key was being modified. However, this scenario is very similar to the case for a many-to-many join type, where the composite primary key is also not the end of any relationship, but forces the two many-to-one relationships to be identifying. I prepared a PR that would only throw if the key involved is alternate, but on reflection that doesn't seem like an appropriate distinction to make. So overall, I think we should just revert this change, which is what this PR does.
Notes for triage: The underlying issue here is that
I verified using Reflection calls that loading the assembly as before fixes the issues seen with 2.3.1. See #32495. We should check with @mhutch that there isn't some simple fix. Beyond that, I think we have a few options here, but none seem great:
|
…lternate key property (#32492) Fixes #28961 Reverts #30213 for #32385 In #32385, an unconstrained alternate key was added to the model purely to make a non-identifying relationship artificially identifying. #30213 attempted to fix this by throwing that the key was being modified. However, this scenario is very similar to the case for a many-to-many join type, where the composite primary key is also not the end of any relationship, but forces the two many-to-one relationships to be identifying. I prepared a PR that would only throw if the key involved is alternate, but on reflection that doesn't seem like an appropriate distinction to make. So overall, I think we should just revert this change, which is what this PR does.
…nconstrained alternate key property (#32523) * Revert behavior to throw when attempting to modify an unconstrained alternate key property (#32492) Fixes #28961 Reverts #30213 for #32385 In #32385, an unconstrained alternate key was added to the model purely to make a non-identifying relationship artificially identifying. #30213 attempted to fix this by throwing that the key was being modified. However, this scenario is very similar to the case for a many-to-many join type, where the composite primary key is also not the end of any relationship, but forces the two many-to-one relationships to be identifying. I prepared a PR that would only throw if the key involved is alternate, but on reflection that doesn't seem like an appropriate distinction to make. So overall, I think we should just revert this change, which is what this PR does. * Quirk
I've added an option to Mono.TextTemplating to allow the host to disable the use of I have also made some changes to the loading behavior when using If these solve the issue, I can backport to 2.3.x and make a new release. |
@mhutch I tried first with the latest preview package, and that still failed. But then I built packages locally from your main branch and used those, and all the tests pass even without setting Sorry for being slow to test this, and thanks for the quick fix! As soon as a preview package is available, we can update our main branch, which will allow customers to test with our daily build. |
@ajcvickers preview package 3.0.0-preview-0045-g9b6fc72764 is now live |
All: If you have been hitting this, then please try out the latest daily build of EF Core and let us know if the problem is fixed. |
Do the daily builds now require dotnet 9? I followed the instructions on the linked page but can't seem to get the daily build installed on a dotnet 8 based project |
@jcummings2 EF9 should not require .NET 9 at this time. If you are seeing an issue with this, can you please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate. |
I got it to work with .NET 8 but it was a subtle step that is at best implied on the daily builds instructions related to which version to use. Simply pasting the wildcard However, after I went into the NuGet package manager in Visual Studio and selected "Latest prerelease 9.0.0-*" for each package then it would build and run. Maybe I missed a step but hopefully these details will help someone else. |
Removing this from the project file fixed the issue for me, without having to use .NET 9:
|
When I updated all versions to 8, T4 started giving the following error.
The text was updated successfully, but these errors were encountered: