sdk: Unable to migrate multi-project solution to Asp.net Core 1.1
Migration tool does not seem to support multiple project solutions well.
ReciPiBook.Api Message src\ReciPiBook.Api\ReciPiBook.Api.xproj: Failed to migrate XProj project ReciPiBook.Api. ‘dotnet migrate -s -p “C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\src\ReciPiBook.Api” -x “C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\src\ReciPiBook.Api\ReciPiBook.Api.xproj”’ exited with error code 1. src\ReciPiBook.Api\ReciPiBook.Api.xproj: Could not find file ‘C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\src\ReciPiBook.Services\project.json’. Migration failed. src\ReciPiBook.Api\ReciPiBook.Api.xproj: Backing up C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\src\ReciPiBook.Api\ReciPiBook.Api.xproj to C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\Backup\src\ReciPiBook.Api\ReciPiBook.Api.xproj. src\ReciPiBook.Api\project.json: Backing up C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\src\ReciPiBook.Api\project.json to C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\Backup\src\ReciPiBook.Api\project.json.
Steps to reproduce
Clone https://github.com/napalm684/ReciPiBookCore Open in vs2017rc or run migration command
Expected behavior
Migration tools succeed or provide feedback on why it failed/steps to correct.
Actual behavior
Failures without clear reason (see errors above)/unable to even recreate the projects manually nuget packages will install in the projects (ie: Microsoft.AspNetCore.Mvc in the ReciPiBook.Api project) but are not recognized by the compiler.
Environment data
dotnet --info output:
C:\Users\xxx>dotnet --info .NET Command Line Tools (1.0.0-preview3-004056)
Product Information: Version: 1.0.0-preview3-004056 Commit SHA-1 hash: ccc4968bc3
Runtime Environment: OS Name: Windows OS Version: 10.0.14393 OS Platform: Windows RID: win10-x64
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 7
- Comments: 28 (7 by maintainers)
I got my project working in VS2017RC (finally). Here’s the process I followed:
project.json). I also installed the “Visual Studio 2015 Tools (Preview 2)” from the .NET Core downloads page page - I’m not sure which order I did these in or if it matters.Update-Packagein the package console.global.jsonfile and set the SDK version to1.0.0-preview3-004056(this is the version thatdotnet --infosays I have installed).dotnet migrateand thendotnet restore.project.jsonand*.xprojfiles from the project tree.It even runs on the Mac preview of VS2017RC but none of the
dotnet efcommands work, they still expect aproject.jsonfile.I have seen the same issue when migrating a solution to VS 2017 RC: in the solution there are projects A and B, B depends on A. Project A is migrated successfully and its project.json is moved, then when it tries to convert project B, it looks for project A’s project.json, but it’s not there since it was already moved. There are three issues:
Repro: https://github.com/lucabol/FollowTheGuru , open in VS 2017 RC
Some suggestions after having gone through this process a couple times:
dotnet migratethemselves from the solution directory (if it’s a multi-project solution) to avoid this issue.I’m seeing the same issues.
dotnet migratefrom the directory the solution is in seems to create the.csprojfiles as @piotrpMSFT says..xprojfiles from the solution and add the.csprojfiles nothing works, there are a ton of errors.Is the migration supposed to handle the items covered in the instructions for upgrading to ASP.NET Core 1.1 on the blog or do those steps need to be done manually?
@piotrpMSFT So I attempted suggestion one and the migration returned 8 of 8 migrated projects in the output.
But when I opened visual studio 2017 rc it still prompted me that the projects needed migrated which resulted in all projects failing this pass. So I attempted it again not migrating when the popup came up and the projects wouldn’t load designating each one in solution explorer as Migration Needed.
_EDIT_ I then noticed xproj was in the solution file so I updated to csproj. All projects are unable to be loaded with an unspecified error per visual studio.
In trying suggestion two, I am cd’d into the project directory so for example ReciPiBook.Dtos. Running dotnet migrate results in “No executable found matching dotnet-migrate”
As for the nuget re-creation no I do not have that in my repo. I can attempt that if needed I just think it feels like a side-effect of the failed migration? But let me know if you would like it anyway.
For the project-to-project dependencies, you have two options:
--skip-backupso the project.json files are left behind. Then manually clean up these files.If Migrate is pointed to a leaf-node project then it assumes it’s done everything necessary and cleans up the PJ contents. It doesn’t have enough data to know better. The project.json file structure was quite implicit so there’s not an explicit description of what all is dependent on a given library.
We’re thinking of adding a message on missing project.json files to say “You may have migrated a dependency project independently. Please revert that migration, or copy the artifacts from the generated
backupdirectory to enable migration of dependent projects. We recommend running migrate from a parent directory when migrating multi-project solutions.” Thoughts?You can see the error if you run the
dotnet migratecommand manually from each project directory - it’s prematurely discarding theproject.jsonfile during conversion (it saves a backup you can put back in place).I manually upgraded each project in my solution to get around this issue and then ran into another one.