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

Scaffolding generates wrong namespace #12176

Closed
sam-wheat opened this issue May 30, 2018 · 7 comments
Closed

Scaffolding generates wrong namespace #12176

sam-wheat opened this issue May 30, 2018 · 7 comments

Comments

@sam-wheat
Copy link

Looks like same issue reported here.

Expected:
namespace NPBOverrides.RiskDB.Model

Actual:
namespace NPBOverrides.RiskDB_Model

@smitpatel
Copy link
Member

What is the command being run?

@sam-wheat
Copy link
Author

C:\Git\NPBOverrides\NPBOverrides>dotnet ef dbcontext scaffold -o ..\NPBOverrides
.RiskDB.Model "server=zzz" Microsoft.EntityFrameworkCore.SqlServer

Versions:
2.0.3
and also
2.1

@smitpatel
Copy link
Member

#9787 is fixed in 2.1 release. Are you sure you are using 2.1 version of EF Core? It should not have above issue.

The command you shared is scaffolding model outside of current project directory (notice ../ at the start). We cannot compute correct namespace in such case (see #9723). We would be using default namespace in that case.

I am unable to reproduce this issue in 2.1 packages using the details you shared.

@sam-wheat
Copy link
Author

My error sorry. I upgraded EntityFrameworkCore packages to 2.1.0 however this did not upgrade package Microsoft.EntityFrameworkCore.Tools.DotNet so above comments are actually related to 2.0.3 only.

After upgrading to 2.1.0-preview1-final I get this:

Expected:
namespace NPBOverrides.RiskDB.Model

Actual:
namespace NPBOverrides

Same command being run as previous.

<PropertyGroup>
  <OutputType>Exe</OutputType>
  <TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
  <PackageReference Include="Inflector.NetStandard" Version="1.2.2" />
  <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" />
  <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.0" />
  <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.0" />
</ItemGroup>

<ItemGroup>
  <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.1.0-preview1-final" />
</ItemGroup>

@smitpatel
Copy link
Member

Microsoft.EntityFrameworkCore.Tools.DotNet is part of dotnet SDK now. You should remove reference to it from your csproj and install 2.1 .NET Core SDK to get dotnet ef commands.

@smitpatel
Copy link
Member

Duplicate of #9723

@smitpatel
Copy link
Member

Marking as duplicate since in 2.1 version, we would be using default namespace if the output dir is outside of current project dir.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants