Results 1 to 7 of 7

Thread: [RESOLVED] I can't merge two projects into one

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    146

    Resolved [RESOLVED] I can't merge two projects into one

    Sorry I'm new to C#

    I'm trying to implement a Wizard from http://www.codeproject.com/KB/dialog/tswizard.aspx

    That solution comprises two projects, one of which is wizard class library and another one is demo window application.


    Somehow I can't merge those two projects into one. I get all kinds of errors.



    Any help would be appreciated.
    Thanks in advance
    Last edited by winterslam; Jun 29th, 2009 at 08:30 PM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: I can't merge two projects into one

    Noone ever said you were supposed to be able to merge two projects into one. You should just keep the wizard control or whatever in a DLL project and then reference that from your application, which is exactly what the demo does. If you put all the wizard code into your application then how will you use it again in the next application? You'd have to copy all the code into every application you wanted to use it in, which is silly. The whole point of DLLs is that they contain reuable components so you don't have to write the same code over and over.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    146

    Re: I can't merge two projects into one

    Thanks for reply

    So is there absolutely no way to combine the wizard class and the application?
    I just have some problems with the reference names and namespaces. I hope someone could help me out.


    I want to combine just to reduce the complexity of my whole project

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: I can't merge two projects into one

    Quote Originally Posted by winterslam View Post
    So is there absolutely no way to combine the wizard class and the application?
    No automatic way, no. You can certainly do it by hand.
    Quote Originally Posted by winterslam View Post
    I just have some problems with the reference names and namespaces. I hope someone could help me out.
    Maybe that's the issue you should have asked us about in the first place. Given that still haven't told us what those problems actually are, help on that front is unlikely at this point.
    Quote Originally Posted by winterslam View Post
    I want to combine just to reduce the complexity of my whole project
    Combining those two projects is not going to achieve that. You reference all the DLLs from the Framework already. Is that complex? Referencing a library and importing a namespace is a few mouse clicks:

    1. Click the Add button on the References page of the project properties.
    2. Navigate to the DLL or project you want to reference and click OK.
    3. Check the namespace you want import.

    Like I said, even if you did combine those two projects, what happens next time you want a wizard? Will you combine projects again, or would referencing a DLL be less complex?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    146

    Re: I can't merge two projects into one

    Of course I'm aware that it can't be done automatically.

    I was trying to do manually but to no avail


    I changed the wizard project type from class library to windows app.
    Then I imported the forms and resources from the windows app project.



    What else does it need to be done?

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    146

    Re: I can't merge two projects into one

    Code:
    public class DemoWizard : TSWizards.BaseWizard
    	{
    		private System.ComponentModel.IContainer components = null;
    
    		public DemoWizard()
    		{
    			// This call is required by the Windows Form Designer.
    			InitializeComponent();
    
    			// TODO: Add any initialization after the InitializeComponent call
    			Logo = new Bitmap(typeof(DemoWizard), "customLogo.jpg");
    		}
    This line is causing the problem
    Logo = new Bitmap(typeof(DemoWizard), "customLogo.jpg");

    The debugger says "Resource 'customLogo.jpg' cannot be found in class TSWizards.DemoWizard

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: I can't merge two projects into one

    Quote Originally Posted by winterslam View Post
    Of course I'm aware that it can't be done automatically.

    I was trying to do manually but to no avail
    That's the exact opposite of what I said. I said that is can't be done AUTOMATICALLY. The only way it CAN be done is manually. You're just not doing it correctly.
    This line is causing the problem
    Logo = new Bitmap(typeof(DemoWizard), "customLogo.jpg");

    The debugger says "Resource 'customLogo.jpg' cannot be found in class TSWizards.DemoWizard
    So you need to add the resource. If that code was in the original DLL project and that project contained that resource and now you want to use that code in a different project then you need to add that resource to the new project.

    I still say that what you're doing is a very bad idea and you should simply keep it as two projects. That is a better way to go for several reasons that I'm not going to repeat.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width