Rousseau10
Programmer
Hi all,
I am using vs2013 update 4.
I'm having some difficulties and thinking my approach is wrong from the get go.
I have made a "business logic" class in C# console app thinking ahead that I could compile this class to a dll an then
in an MVC project (or any other .Net project for that matter), just add a reference to that dll and a using statement and
the class and it's members would be exposed for me to use.
What I tried:
Created a class library project > added the class I made and tweaked in the console app > compiled it to a dll.
I then Added reference to it in an existing MVC project, added a using statement same name as the class which is also the same name as the dll. Rebalance.dll.
I had no luck. I got the msg (are you missing a directive or assembly reference).
I googled and tried every approach I could find on the web, from using an Imports statement to Unsafe code, using an [attribute] line of code to tell VS I want to use this dll. I tried Unmanaged , interop, and unsafe unmanaged code examples to no avail. Then it hit me that maybe my overall approach was wrong from the beginning. I tried all kinds of approaches. even ILMerge to merge the dll with an exe in a console app just to test that(which defeats the purpose anyway of using an independent dll.) It was just a stab at it.
I know this cannot be that hard.
So please correct me in my initial thinking.
I thought I would just write and test the class in a console app. compile it to a dll. Then add a reference to it in another project with a using statement.
And voowallaa. I could go:
using...;
using NewBalance;
namespace FOOBAR
{
};
But all I got was the msg (are you missing a directive or assembly reference).
How do I need to do this?
Thanks in advance!
Adam
I am using vs2013 update 4.
I'm having some difficulties and thinking my approach is wrong from the get go.
I have made a "business logic" class in C# console app thinking ahead that I could compile this class to a dll an then
in an MVC project (or any other .Net project for that matter), just add a reference to that dll and a using statement and
the class and it's members would be exposed for me to use.
What I tried:
Created a class library project > added the class I made and tweaked in the console app > compiled it to a dll.
I then Added reference to it in an existing MVC project, added a using statement same name as the class which is also the same name as the dll. Rebalance.dll.
I had no luck. I got the msg (are you missing a directive or assembly reference).
I googled and tried every approach I could find on the web, from using an Imports statement to Unsafe code, using an [attribute] line of code to tell VS I want to use this dll. I tried Unmanaged , interop, and unsafe unmanaged code examples to no avail. Then it hit me that maybe my overall approach was wrong from the beginning. I tried all kinds of approaches. even ILMerge to merge the dll with an exe in a console app just to test that(which defeats the purpose anyway of using an independent dll.) It was just a stab at it.
I know this cannot be that hard.
So please correct me in my initial thinking.
I thought I would just write and test the class in a console app. compile it to a dll. Then add a reference to it in another project with a using statement.
And voowallaa. I could go:
using...;
using NewBalance;
namespace FOOBAR
{
class Test
{
Rebalance nb = new ReBalance();
int RemainingDays = nb.GetRemainingDays(ReceivedDate,ReplenishDate);
};};
But all I got was the msg (are you missing a directive or assembly reference).
How do I need to do this?
Thanks in advance!
Adam