0

I am working on a Windows Service Application. 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. 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! 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.

Now my Service project cannot reference my Class Library project because the library doesn't have a .dll or .exe extension? I actually have to specify this somewhere, WhereTF do I do this? Isn't this the default behavior of a ClassLibrary? OMG! I just finished an iOS application, and NEVER thought that would be EASIER than a C# app! I did this in VS2010 easily, is 2015 really different?

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. Giving MS a MegaMindWedgie right now..

Don't need portability with RT hardware, just want 32-bit/64-bit computer apps.

All 3 projects are using the same namespace. I can't seem to add any references to the ClassLibrary project like I can in the Service project. It's blank. The only reference available to the Class Library project is .NETStandard,Version=v1.6

All I see when I choose Add->Reference

HELP...

Quadrivium
  • 137
  • 2
  • 2
  • 15
  • 2
    This was answered before, [Here](http://stackoverflow.com/questions/1228335/how-do-i-use-a-c-sharp-class-library-in-a-project), [Here](http://stackoverflow.com/questions/18586243/how-do-i-install-a-c-sharp-class-library-in-visual-studio) & [Here](http://stackoverflow.com/questions/7606217/how-to-reference-a-c-sharp-class-library-project-in-visual-studio-2010) – Ahmed I. Elsayed Oct 08 '16 at 19:07
  • 2
    DId you perhaps added a .net core class library? – HansVG Oct 08 '16 at 19:08
  • I've done this in VS2010 but then it was a "DLL project" . Something is FUBAR'd with the VS2015 ClassLibrary project default settings because the Assembly info is all blank, there are no AddReference options, and when I build it, NO dll is being created. – Quadrivium Oct 08 '16 at 19:27
  • Ahmed I. Elsayed : I've done this all in VS2010, VS2016 is doing something COMPLETELY DIFFERENT I did exactly what your links say to do. I can't add anything... – Quadrivium Oct 08 '16 at 19:42
  • Every single time I deal with Microsoft, i turn into TorretDave! Tower of Babel needs to fall.... – Quadrivium Oct 08 '16 at 19:44
  • In your Windows service app, when you Add Reference, you should see 4 options: Assemblies, Solution, COM, Browse. What happens when you select Solution and under that "Projects" and then tick the ClassLibrary project and click OK? The ClassLibrary project is part of the Solution, right? – John D Oct 08 '16 at 20:09
  • I did and it says that you cannot add a reference to something that isn't a dll or exe. The template for ClassLibrary is completely screwed up. I've killed it and recreated it twice now, and it's not even trying to build a dll or exe – Quadrivium Oct 08 '16 at 20:13
  • I cannot add any references for frameworks I need for the classes in the ClassLibrary beyond what's in the default .NETStandard,Version=v1.6, so none of them will compile. – Quadrivium Oct 08 '16 at 20:15
  • I've done this a hundred times myself, but something is really screwed up, and I am seeing many other posts like this, which leads me to believe that my install is somehow screwed up, and when I create a ClassLibrary project, because the Template is screwed up, it's not setting up the project correctly, so I cannot add any references to anything that isn't in the .NETStandard,Version=v1.6 library. – Quadrivium Oct 08 '16 at 20:25

1 Answers1

2

It looks like you have created .NET Core class library. 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. Most probably, you don't need a .NET Core class library. So, your problem will go away if you create .NET Framework Class Library project.

oldbam
  • 2,397
  • 1
  • 16
  • 24
  • You are right, but I didn't CHOOSE core .NET, going back and looking at the options, I only see Class Library (Universal Windows) option. I will try that... – Quadrivium Oct 08 '16 at 20:42
  • Nope. I need really old compatibility for this project. I am coding to use a really old AccessDB (.mdb) file, and the minumum build for this option was Windows 10 versions... Maybe becasue i am using Windows10 this is what I'm seeing. I miss my old Windows 7 system, – Quadrivium Oct 08 '16 at 20:44
  • 1
    right-click on your project, select properties, search for a Target Framework or something similar – oldbam Oct 08 '16 at 20:51
  • The project I created just won't let me change any of that. I created a ClassLibrary from the ClassicWindows sub heading and now I have the libs I need to add. – Quadrivium Oct 08 '16 at 21:01
  • basically tossed out my whole morning. Starting again.. happens a lot in MS world.... But if management had listened to me 4 years ago and let me update the Manufacturing systems away from the WindowsXP systems still in place, I wouldn't have a pile of hair on the floor right now. – Quadrivium Oct 08 '16 at 21:03
  • 1
    I believe you should be able to create "old" csproj class library. I don't have .NET Core tooling at the moment, so can't check, but carefully look at the options when you are creating a new project, and try to choose .Net Framework. Good luck! :| – oldbam Oct 08 '16 at 21:07