简体   繁体   中英

Installing package from nuget adds project to solution in Visual Studio 2015

Created .NET Core ASP.NET app, then added Nuget reference (from my local repository) to the assembly XYZ (.NET Core class library) I built on the same machine. Instead of just adding the .dll, I got XYZ.xproj added to the solution. I don't want this. I need to test XYZ like if it was never developed on this computer.

Moreover, the ASP.NET project even does not build. I'm getting: "An item with the same key has already been added. Key: XYZ". Looks like the conflict appears that the library is trying to be added both as nuget reference and project.

How can I tell Nuget not to try adding a project? I can achieve the same result if I rename XYZ folder before adding a Nuget reference (so that VS can't find the project folder) but this dirty hack doesn't make me happy.

Nuget and Visual Studio 2015 are updated to the latest.

Ok, if I create ASP.NET project with "Create directory for solution" checkbox enabled, this works as needed. Otherwise, the sln file gets placed into top folder for which XYZ library's folder is relative This makes Visual Studio easily find and load XYZ project in case if both ASP.NET app folder and XYZ libary folder are under common parent folder (my case). Creating directory for solution moves sln file deeper and XYZ folder is no longer relative to sln file location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM