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

PMC Tools fail when directory contains "[" #16649

Closed
yangbocheng opened this issue Jul 18, 2019 · 11 comments · Fixed by #22169
Closed

PMC Tools fail when directory contains "[" #16649

yangbocheng opened this issue Jul 18, 2019 · 11 comments · Fixed by #22169
Assignees
Labels
area-tools closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported punted-for-3.1 type-bug
Milestone

Comments

@yangbocheng
Copy link

I want your help
I have created a totally new Net Core SDK 2.2.0 web program.(named "web2_2new")
Just edit this .csproj, and then test Add-Migration. Then it tells:

PM> add-migration vc1
Unable to resolve startup project ''.
Using project 'web2_2new' as the startup project.
Your startup project 'web2_2new' doesn't reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work. Ensure your startup project is correct, install the package, and try again.

proj:

netcoreapp2.2 InProcess
@yangbocheng
Copy link
Author

proj:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.0" />
    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.0" />
  </ItemGroup>

</Project>

@ajcvickers
Copy link
Member

@yangbocheng Can you post the project/solution here?

@yangbocheng
Copy link
Author

@ajcvickers

I hava found the reason, maybe it's a problem about path.

If the name of folder contains "[" or "[any]", Use "Add-migration", it will produce the error

Those wrong path like:
"D:\2017\ASP.NET Core[1\web1\yoursolution"    --->other error
"D:\2017\ASP.NET Core[1]\web1\yoursolution"     --->doesn't reference Microsoft.EntityFrameworkCore.Design

@ajcvickers
Copy link
Member

/cc @bricelam

@bricelam bricelam self-assigned this Jul 22, 2019
@bricelam bricelam changed the title Add-Migration always failed < doesn't reference Microsoft.EntityFrameworkCore.Design PMC Tools fail when directory contains "[" Jul 22, 2019
@ajcvickers ajcvickers added this to the Backlog milestone Jul 29, 2019
@bricelam bricelam modified the milestones: Backlog, 3.1.0 Aug 21, 2019
@ajcvickers ajcvickers modified the milestones: 3.1.0, Backlog Oct 11, 2019
@bricelam bricelam modified the milestones: Backlog, 5.0.0 Nov 5, 2019
@smitpatel
Copy link
Member

PM> Add-Migration Init
Unable to resolve startup project ''.
Using project 'ConsoleApp[6]' as the startup project.
Build started...
Build succeeded.
System.IO.FileLoadException: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive)
   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
   at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String dataDirectory, String rootNamespace, String language, String[] remainingArguments)
   at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor(String[] remainingArguments)
   at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsAddCommand.Execute(String[] args)
   at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
   at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)


Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

csproj

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <RootNamespace>ConsoleApp_6_</RootNamespace>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0-preview.7.20365.15">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0-preview.7.20365.15" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0-preview.7.20365.15">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

</Project>

Containing folder name ConsoleApp[6]

@smitpatel
Copy link
Member

renaming folders/solution/csproj file to remove brackets make it work.

@bricelam
Copy link
Contributor

-Verbose?

@smitpatel
Copy link
Member

Will try with that. There were also few mistakes on my part. Probably need to run restore again after renames?
First error I am focusing on is why the startup project was not resolved.

@smitpatel smitpatel self-assigned this Aug 21, 2020
@bricelam
Copy link
Contributor

bricelam commented Aug 21, 2020

I'm also happy to take over the investigation too, if you want. I was going to tackle this one alongside the network path issues.

@smitpatel
Copy link
Member

I saw poachable label so I was looking if this is something I can even understand. Up to you, feel free to un-assign me if you want to take over. I can dig in with my little knowledge and some guidance. 😨

@bricelam
Copy link
Contributor

I'll take it and free you up to add more value elsewhere. 😉

bricelam added a commit to bricelam/efcore that referenced this issue Aug 21, 2020
These parameters accepted wildcard characters causing problems.

Fixes dotnet#16649
@bricelam bricelam added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Aug 21, 2020
bricelam added a commit to bricelam/efcore that referenced this issue Aug 21, 2020
These parameters accepted wildcard characters causing problems.

Fixes dotnet#16649
@bricelam bricelam modified the milestones: 5.0.0, 5.0.0-rc1 Aug 21, 2020
@ghost ghost closed this as completed in #22169 Aug 21, 2020
ghost pushed a commit that referenced this issue Aug 21, 2020
These parameters accepted wildcard characters causing problems.

Fixes #16649
@ajcvickers ajcvickers modified the milestones: 5.0.0-rc1, 5.0.0 Nov 7, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-tools closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported punted-for-3.1 type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants