0

I've a C# solution that consists of an MVC project and a Windows Application project. Is there any way for MVC to call a Windows Application method and pass values to it?

I added Windows Application to References in the MVC project. But when adding the namespace reference using Windows Application name in the MVC class, it can't be found.

I appreciate any pointers.

3
  • 2
    That should work. Double check your namespace. Check build order. Commented Nov 12, 2013 at 19:52
  • 1
    Yes, check your build settings. Did you make the classes public? Commented Nov 12, 2013 at 19:57
  • The Application class is by default internal. (This is what C# defaults to when you create a class) You will have to change this to public Commented Nov 12, 2013 at 19:59

2 Answers 2

2

Check that classes are public (else you can't call methods from the class) and that you have added reference to the project in your solution.

Sign up to request clarification or add additional context in comments.

Comments

1

Take the code that's shared between the two, add a class library, and place it in there. That's what they are for. Past this, referencing a Windows application (.exe) is sure to be an issue even further down the road.

2 Comments

I agree that this is the ideal solution. However, this does not explain why the reference fails. Changing from a an EXE to a DLL doesn't explain it.
@P.Brian.Mackey, right you are sir. I'm guessing a little code snippet would help solve that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.