[英]Create Project Reference to net451 xproj Class Library from ASP.NET 4.6
I need to debug my class library. 我需要调试我的类库。 In Visual Studio 2015, I created an ASP.NET 4.6.1 web application.
在Visual Studio 2015中,我创建了一个ASP.NET 4.6.1 Web应用程序。 Within the same solution, I created a new Class Library (Package) project (xproj file).
在同一解决方案中,我创建了一个新的类库(包)项目(xproj文件)。
This class library only uses the net451
framework, as you can see from my project.json file. 从我的project.json文件中可以看到,该类库仅使用
net451
框架。
{
"version": "1.0.0-*",
"description": "Services Class Library",
"authors": [ "David" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"net451": {
"dependencies": {
"EntityFramework6.Npgsql": "3.1.0",
"Microsoft.AspNet.Identity.EntityFramework": "2.0.0",
"Microsoft.CSharp": "4.0.1",
"Newtonsoft.Json": "9.0.1",
"System.Collections": "4.0.11",
"System.ComponentModel": "4.0.0",
"System.ComponentModel.Annotations": "4.1.0",
"System.Linq": "4.1.0",
"System.Runtime": "4.1.0",
"System.Threading": "4.0.11"
},
"frameworkAssemblies": {
"System.IdentityModel": "4.0.0.0"
}
}
},
"dependencies": {
"System.IdentityModel.Tokens.Jwt": "4.0.2.206221351"
}
}
Within the site, I can reference the library if I browse to the DLL. 在站点内,如果浏览到DLL,则可以引用该库。 But I cannot create a project reference.
但是我无法创建项目参考。 Without the project reference, I cannot seem to debug the library while running the site.
没有项目参考,我似乎无法在运行站点时调试库。 Is this even possible?
这有可能吗? I'm not doing any .NET Core stuff as you can see.
如您所见,我没有做任何.NET Core东西。 And I don't care about the ability for the library to be a NuGet package.
而且我也不在乎库是否可以成为NuGet软件包。 I sense that if I could create a csproj class library instead of an xproj library, then this wouldn't be an issue, but I can't find a way to do that.
我感觉到,如果我可以创建一个csproj类库而不是一个xproj库,那么这将不是问题,但是我找不到解决方法。
Before posting the question, I took a few more minutes to try to create a csproj project. 在发布问题之前,我花了几分钟尝试创建一个csproj项目。 I discovered that you can do so when creating a Class Library under the Visual C# Windows templates instead of the Web templates.
我发现在Visual C# Windows模板而不是Web模板下创建类库时,您可以这样做。 I removed my xproj project from the solution, moved the files elsewhere on my drive, created a new project with the same name, copied the files back over and restored the references, and all was good.
我从解决方案中删除了xproj项目,将文件移动到驱动器上的其他位置,创建了一个具有相同名称的新项目,将文件复制回并恢复了引用,一切都很好。 I can now step into the library functions while debugging.
现在,我可以在调试时进入库函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.