Skip to content

Add-Migration unable to link scripts with UNC path #14781

Closed as not planned
Closed as not planned

Description

@JagdCrab

When running Add-Migration for the project located on a network folder, migration fails with following error:

Add-Migration : Cannot add the link because the source file '\\\\Network Share\Folder\Solution\Project\Migrations\00000000000000_Create.cs' cannot be found.
At line:1 char:1
+ Add-Migration Create
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [Add-Migration], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Add-Migration

So, it seems that problem is in two extra backslashes in UNC address that Add-Migration is trying to use

\\\\Network Share\Folder

rather then

\\Network Share\Folder

Files are actually created and can be found in network folder, but not added to project.
If generated files manually added to Project though Add.. - Existing Item and then Update-Database executed - Migration completes successfully.
If Project is open from same location but with Mapped Network Drive rather then UNC - it works fine.

VisualStudio 2017 15.9.7
.Net 4.6.1
EFC 2.2.2.0

Activity

  1. changed the title [-]Add-Migration unale to link scripts with UNC path[/-] [+]Add-Migration unable to link scripts with UNC path[/+] on Feb 22, 2019
  2. added this to the 3.0.0 milestone on Feb 22, 2019
  3. modified the milestones: 3.0.0, Backlog on Jun 21, 2019
  4. modified the milestones: Backlog, on Aug 21, 2019
  5. removed this from the milestone on Oct 11, 2019
  6. 6 remaining items

  7. Psypher9 commented on Dec 12, 2019

    @Psypher9
    Contributor

    My cursory look over this seems to suggest that the calls to the EnvDTE here would be throwing this exception.

    Is this possibly happening because of this:

            public static string Literal(string text)
                => text != null
                    ? "\"" + text.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\""
                    : "null";

    in ef/Json.cs#L14-L17? I can see that we are trying to espcape the backslashes for JSON, so if we need to keep this, perhaps at this location in the PMC we could double-check the filename to make sure that it doesn't have double-double backslashes? Thoughts?

  8. Psypher9 commented on Dec 20, 2019

    @Psypher9
    Contributor

    I've got an idea that doesn't require most of what I said before. I'm testing it now. @bricelam am I good to open a PR once I've validated the changes?

  9. bricelam commented on Jan 2, 2020

    @bricelam
    Contributor

    Always feel free to submit PRs!

  10. removed this from the 5.0.0 milestone on Aug 21, 2020
  11. ajcvickers commented on Aug 24, 2020

    @ajcvickers
    Contributor

    We can no longer reproduce this and believe that the underlying issue has been fixed. If you are still hitting this issue with EF Core 5.0 or later, then please file a new issue and attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions