Reputation: 3563
I have problem with nuget packet management when using a shared project among different solutions which are located in different directories. One of the solution is using nuget, other one is not. The problem is that the packet manager adds a line into .csproj file:
Now as the nuget packet management is only used among the shared project, a solution to the problem would be to change $(SolutionDir) to $(ProjectDir). This works and solves the problem for now.
Now whenever reopening the solution which has nuget packet management enabled, it automatically adds the same line (as shown on the picture above) into the shared project .csproj file, which again breaks loading the project from the other solution.
How to prevent the automatic generation of that import clause or is there any other elegant solution to the problem?
Upvotes: 0
Views: 217
Reputation: 9189
Enabling NuGet Package restore in the solution that doesn't use NuGet should fix your problem (right click the solution, enable package restore). While you aren't using NuGet in that project it doesn't really hurt to have that option turned on.
Personally I try never reference the same project from multiple solutions, and turn them into private NuGet packages instead. It can be a bit of a pain to development like this, as you need to create the new package, deploy then install it in your other project. But it solves many other headaches, like the one you're currently having and having developers accidentally break other projects when they check in.
Upvotes: 1