简体   繁体   English

Visual Studio 2015类库(我正在使用C#)

[英]Visual Studio 2015 Class Library (I'm using C#)

I am working on a Windows Service Application. 我正在研究Windows服务应用程序。 I have several classes in the project and I am trying to put these classes into a ClassLibrary so I can use those classes in the Service App Project, and also in a Console Application Project, so I can run the console version and step through the code. 我在项目中有几个类,我试图将这些类放入ClassLibrary中,以便可以在Service App Project和Console Application Project中使用这些类,以便可以运行控制台版本并逐步执行代码。 。 I don't want to re-invent the wheel here... 我不想在这里重新发明轮子...

I have created a Class Library project, and I am having trouble updating the projects in this Solution to use these classes. 我已经创建了一个类库项目,但是在更新此解决方案中的项目以使用这些类时遇到了麻烦。 In fact, when I moved all my classes into the Class Library project, they are all now throwing errors saying, "System" has no member "Data"! 实际上,当我将所有类移入“类库”项目时,它们现在都抛出错误,说“系统”没有成员“数据”! My A$$ it doesn't! 我的A $$没有! Pulling my hair out. 拉我的头发。

Obviously, I have done something wrong. 显然,我做错了什么。 I've been programming since before there WAS a Visual Studio IDE, but this is SEEMING way more complicated than it should be. 从那时起,我就一直在进行Visual Studio IDE的编程工作,但是SEEMING的方式比应该的要复杂得多。

Now my Service project cannot reference my Class Library project because the library doesn't have a .dll or .exe extension? 现在我的服务项目无法引用我的类库项目,因为该库没有.dll或.exe扩展名? I actually have to specify this somewhere, WhereTF do I do this? 我实际上必须在某处指定此位置,我在哪里执行此操作? Isn't this the default behavior of a ClassLibrary? 这不是ClassLibrary的默认行为吗? OMG! 我的天啊! I just finished an iOS application, and NEVER thought that would be EASIER than a C# app! 我刚刚完成了一个iOS应用程序,再也没有想到这比C#应用程序容易! I did this in VS2010 easily, is 2015 really different? 我在VS2010中轻松做到了这一点,2015年真的有所不同吗?

It should take me no more than 30 minutes to move files from one project in a solution to it's own project, and then add a reference to that new project in the old one. 将文件从一个解决方案中的一个项目移到自己的项目,然后在旧项目中添加对该新项目的引用,我应该花不超过30分钟的时间。 Giving MS a MegaMindWedgie right now.. 立即为MS提供MegaMindWedgie。

Don't need portability with RT hardware, just want 32-bit/64-bit computer apps. 不需要RT硬件的可移植性,只需要32位/ 64位计算机应用程序即可。

All 3 projects are using the same namespace. 所有3个项目都使用相同的名称空间。 I can't seem to add any references to the ClassLibrary project like I can in the Service project. 我似乎无法像在Service项目中那样对ClassLibrary项目添加任何引用。 It's blank. 是空白 The only reference available to the Class Library project is .NETStandard,Version=v1.6 可用于类库项目的唯一参考是.NETStandard,Version = v1.6

选择“添加”->“参考”时看到的所有内容

HELP... 救命...

It looks like you have created .NET Core class library. 看起来您已经创建了.NET Core类库。 You can determine this based on the extension of the project file: *.csproj has been used with classic .NET framework projects, and *.xproj was introduced for .NET Core. 您可以根据项目文件的扩展名确定这一点:* .csproj已用于经典.NET框架项目,而* .xproj则是针对.NET Core引入的。 Most probably, you don't need a .NET Core class library. 最有可能的是,您不需要.NET Core类库。 So, your problem will go away if you create .NET Framework Class Library project. 因此,如果您创建.NET Framework类库项目,则问题将消失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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