Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

If NuGet Targets are pressent, then the project can't be converted #124

Open
Lohnegrim opened this issue Nov 7, 2019 · 5 comments
Open

Comments

@Lohnegrim
Copy link

Hi,
I noticed, that when a import to NuGet.targets is present, (as was added by EF6.3 install), then the project conversion fails with error 'This project has custom imports in a manner that's not supported.'
The effected line is:
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
Seems like packages with a path in '' are ignored, maybe the path '\.nuget' should also be ignored?

@jmarolf
Copy link
Contributor

jmarolf commented Nov 7, 2019

@Lohnegrim can you point me to a sample project with this targets import? I am not aware of a situation that will cause Entity Framework 6.3 to add a Nuget.targets file. There are samples out there that show how to write a custom targets file that manipulates nuget but our belief was that if you were in this situation you had customized your build which would make it very unlikely the conversion would succeed.

@Lohnegrim
Copy link
Author

Lohnegrim commented Nov 8, 2019

@jmarolf as I just read in https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore#migrate-to-automatic-package-restore-visual-studio the nuget.targets was added by using the deprecated MSBuild-integrated package restore, so it may be better for me to remove it.
Anyway it's an old feature from VS/NuGet, and in my case it was by chance that it was added with EF 6.3

@cartermp
Copy link
Contributor

cartermp commented Nov 8, 2019

@Lohnegrim I believe removing it would probably be the best course of action. I'm not sure we can have this tool support things that older (often deprecated) VS tooling would do to a project. Though in this case if removing the file causes the conversion to work, a quick patch could probably be made with this as a well-known import that we just remove.

@jmarolf
Copy link
Contributor

jmarolf commented Nov 8, 2019

The issue is we have no way of knowing if this target does custom things in your build other than restore nuget. We could emit a better message pointing to these docs and suggesting the user delete the folder and the imports, but assuming they are safe to remove seems like a recipe for disaster.

@sundeepyama
Copy link

I have to remove the below line to fix the error in a test project.

<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants