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.
Clone https://github.com/napalm684/ReciPiBookCore
Open in vs2017rc or run migration command
Migration tools succeed or provide feedback on why it failed/steps to correct.
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.
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
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
Same issue here :( No clear way to proceed because it doesn't give you any info on why its failing.
You can see the error if you run the dotnet migrate
command manually from each project directory - it's prematurely discarding the project.json
file 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.
Even if manual migration behaves (I'd have to try it on my repo) can anyone explain why the projects cannot be recreated manually? As mentioned the nuget installations of libraries like MVC and Microsoft.Extensions.DependencyInjection are not recognized despite successful installation. Is the solution overall left in a bad state because of the failed migration? Maybe this a whole other issue entirely?
@napalm684 I'm guessing here but it looks to me like the migrate
command just migrated the .xproj
projects to .csproj
but didn't actually update any references to libraries or anything. I think the best approach here might be to try to upgrade the projects and solution to .NET Core 1.1 in VS2015 and then once it's running in 1.1 do the migration to VS2017RC.
For the project-to-project dependencies, you have two options:
--skip-backup
so 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 backup
directory to enable migration of dependent projects. We recommend running migrate from a parent directory when migrating multi-project solutions." Thoughts?
@napalm684 I'm not sure about the manual recreation issues. does your repo include the manually generated file?
@piotrpMSFT So I attempted suggestion one and the migration returned 8 of 8 migrated projects in the output.
C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook>dotnet migrate
Project ReciPiBook.Api migration succeeded (C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Api)
Project ReciPiBook.Client migration succeeded (C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Client)
Project ReciPiBook.Di migration succeeded (C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Di)
Project ReciPiBook.Dtos migration succeeded (C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Dtos)
Project ReciPiBook.Entities migration succeeded (C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Entities)
Project ReciPiBook.Repository migration succeeded (C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Repository)
Project ReciPiBook.Services migration succeeded (C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Services)
Project ReciPiBook.Translators migration succeeded (C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Translators)
Summary
Total Projects: 8
Succeeded Projects: 8
Failed Projects: 0
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.
I'm seeing the same issues.
dotnet migrate
from the directory the solution is in seems to create the .csproj
files as @piotrpMSFT says..xproj
files from the solution and add the .csproj
files 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?
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-Package
in the package console.global.json
file and set the SDK version to 1.0.0-preview3-004056
(this is the version that dotnet --info
says I have installed).dotnet migrate
and then dotnet restore
.project.json
and *.xproj
files from the project tree.It even runs on the Mac preview of VS2017RC but none of the dotnet ef
commands work, they still expect a project.json
file.
Thanks for the walkthrough @haraldnagel. The migrate tool only handles PJ -> csproj and does not do the ASP.NET-specific update steps. I'm sure many will benefit from your guide.
The modify sln file
issue is also known and tracked to be fixed in an upcoming release via dotnet/sdk#7100
I am going to attempt this some time today hopefully @haraldnagel to ensure there are not other issues with my particular solution. Installing RC 2017 on my work machine as we speak. I will let the thread know upon completion.
Hi running into this also. In my case I am getting this :
No executable found matching command "dotnet-migrate"
I am running this from project root.
.NET Command Line Tools (1.0.0-preview2-003121)
Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529bc5
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
@NVentimiglia you are using an older .net cli which does not yet have the migration utility. Please upgrade to preview3
Sorry for the delay but I am not having the same success as @haraldnagel . I have gotten it to compile and run in VS2015. I updated the global.json file sdk version to the same one as @haraldnagel . Dotnet migrate completes without error but dotnet restore at the solution level fails.
C:\Program Files\dotnet\sdk1.0.0-preview3-004056\NuGet.targets(164,5): error MSB3202: The project file "C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Client\ReciPiBook.Client.xproj.metaproj" was not found. [C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\ReciPiBook.sln]
C:\Program Files\dotnet\sdk1.0.0-preview3-004056\NuGet.targets(164,5): error MSB3202: The project file "C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Di\ReciPiBook.Di.xproj.metaproj" was not found. [C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\ReciPiBook.sln]
C:\Program Files\dotnet\sdk1.0.0-preview3-004056\NuGet.targets(164,5): error MSB3202: The project file "C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Services\ReciPiBook.Services.xproj.metaproj" was not found. [C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\ReciPiBook.sln]
C:\Program Files\dotnet\sdk1.0.0-preview3-004056\NuGet.targets(164,5): error MSB3202: The project file "C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Api\ReciPiBook.Api.xproj.metaproj" was not found. [C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\ReciPiBook.sln]
C:\Program Files\dotnet\sdk1.0.0-preview3-004056\NuGet.targets(164,5): error MSB3202: The project file "C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Entities\ReciPiBook.Entities.xproj.metaproj" was not found. [C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\ReciPiBook.sln]
C:\Program Files\dotnet\sdk1.0.0-preview3-004056\NuGet.targets(164,5): error MSB3202: The project file "C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Repository\ReciPiBook.Repository.xproj.metaproj" was not found. [C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\ReciPiBook.sln]
C:\Program Files\dotnet\sdk1.0.0-preview3-004056\NuGet.targets(164,5): error MSB3202: The project file "C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Dtos\ReciPiBook.Dtos.xproj.metaproj" was not found. [C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\ReciPiBook.sln]
C:\Program Files\dotnet\sdk1.0.0-preview3-004056\NuGet.targets(164,5): error MSB3202: The project file "C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\src\ReciPiBook.Translators\ReciPiBook.Translators.xproj.metaproj" was not found. [C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook\ReciPiBookCore\ReciPiBook.sln]
EDIT
Upon attempting to reproduce the success I had getting it to run in 2015 I continuously hit this roadblock now:
UPDATE
@haraldnagel was kind enough to fork my repository and I presume following the same instructions as above migrated my project successfully over to 1.1. If I had to guess I had some issues with my project.json files needing tweaked and intend to go over his pull request to reproduce myself. That being the case I would say the issue from my standpoint is resolved, but as @piotrpMSFT mentioned previously I think if the tool cannot be adjusted to handle these scenarios that a message pointing to a troubleshooting guide like the one @haraldnagel discovered on his own would be very helpful. Something akin to symptom -> try these steps?
Got unblocked by nuking my environment and reinstalling.
Some suggestions after having gone through this process a couple times:
dotnet migrate
themselves from the solution directory (if it's a multi-project solution) to avoid this issue.@piotrpMSFT it looks like one of the main problems is with the -s option. In the Visual Studio 2017 RC conversion this is what is run. AND when this same command is run manually this is I believe why it is balking about the project.json not existing in a referenced project.
I just manually converted a 4 project solution and had to do the following
If the -s option worked I believe it should just leave the reference projects alone....
The REALLY crappy thing is that the final project , a web project, says it migrated successfully but won't open in Visual Studio 2017 giving me an "unspecified error"
@ArieJones yea, not fixing the VS experience was a really hard cut in RC and has created a lot of angst. Your point that the calling convention for migrate is a great one. VS calls migrate differently because it has a bunch of useful infrastructure for tracking status of migration for each project and generate nice reports. CLI only has the migrate command so it migrates the solution holistically. The bug + the behavioral delta are really confusing, I agree.
Is the final project something you can strip of interesting bits
and share, at least the csproj? I'd be curious to see if we can figure out what's up. Does that project build from the command line?
Perhaps this is because I am using an old version of the SDK (I am on 1.0.0-preview4-4079) but I notice that the command that Visual Studio tries to run when calling dotnet migrate includes a -p switch that the command does not appear to support. But I can attest to having all the same issues that are reported above when attempting to migrate a preview2 tools xproj + project.json to the preview4 tools csproj. No matter what I try (which includes following the steps mentioned above) results in the web project not getting opened due to an "unspecified error".
@Gzidar do you have a repro we can debug?
I Have the same issue on preview 3 from vs rc 2017
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable"
},
"dependencies": {
"MyLibrary": { "target": "project" },
"NETStandard.Library": "1.6.1",
"ServiceStack.Core": "1.0.*"
},
"frameworks": {
"netstandard1.6": {
}
}
}
The problem is probably there are multiple endpoint projects (not a single project that has all dependencies).
Then it twice migrates. but if they both have dependencies on the same project MyLibrary
it will throw an error trying to migrate any other endpoint projects.
Because this project is already migrated it throws the folowing error:
Could not find file 'C:\Git\src\MyLibrary\project.json'.
Migrate Project from VS2015 to VS2017RC using VS17RC (not the cli).
Migration Completed
"The imported project ...\Microsoft.DotNet.Props" was not found."
.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
How do I resolve this project not being found? I have installed VS2017, and preview3 of the CLI tools.
EDIT: Got around this issue by running dotnet migrate which completed successfully.
if the tool removes the project.json then what about other bits that use the project json? such as AddUserSecrets
from Microsoft.Extensions.Configuration
I guess these will change.
I had some of the issues above, running dotnet migrate
from the root worked fine but I had to re-add the projects back into the solution as the sln
file is not modified , I had a few other issues but after a bit of tinkering all sorted.
Also ensure that there is no global.json specifying an older version of the sdk which causes the dotnet cli to downgrade in the current working directory.
@333fred note the global.json
comment above.
The next release of VS should bring migration closer in line with CLI.
Migrating solutions missed preview4 but will be in preview5. You can try this on latest builds.
Another issue with multiple projects on the same folder is that the obj folder is shared among them, so lock files and project.assets.json are overwritten by subsequent builds, so there can be issues and conflicts.
Just try to create in VS2017 RC both a core console project (netcoreapp1.1) and a netstandard library (netstandard1.6). When you compile you'll get an error similar to
Assets file '<path_to_proj>\obj\project.assets.json' doesn't have a target for '.NETStandard,Version=v1.4'. Ensure you have restored this project for TargetFramework='netstandard1.4' and RuntimeIdentifier=''.
Edit: I found a workaround for this by setting the base intermediate output path to something like
<BaseIntermediateOutputPath>obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
I had also these problems and could not get preview3 or preview 4 installed. Running dotnet-dev-win-x64.1.0.0-preview4-004233.exe
wasn't updating dotnet cli, because it was already dotnet 1.1.0.
I have unzipped the binaries of https://github.com/dotnet/core/blob/master/release-notes/preview4-download.md to C:\Program Files (x86)\dotnet.
Now dotnet migrate
worked, but after opening in VS2017 rc1 it says "needed upgrade" and "unspecified error"
After cleanup, just upgraded by VS2017 (rc1) and not CLI.
Most helpful comment
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-Package
in the package console.global.json
file and set the SDK version to1.0.0-preview3-004056
(this is the version thatdotnet --info
says I have installed).dotnet migrate
and thendotnet restore
.project.json
and*.xproj
files from the project tree.It even runs on the Mac preview of VS2017RC but none of the
dotnet ef
commands work, they still expect aproject.json
file.