0

I have to projects in my solution: StoreHelper and DefaultsSwitcher. Both of them have to create a Windows Executable (their output is application).

Now we are located in StoreHelper. This is my code:

At the top of the file:

using DefaultsSwitcher;

And in the file:

private void defaultsSwitcherToolStripMenuItem_Click( object sender, EventArgs e ) {
    var defaultsSwitcher = new DefaultsSwitcher.dialog();
    defaultsSwitcher.ShowDialog();
}

The code editor does not show any error by underlining, but when I try to build, the compiler say the following error:

Error   1   The type or namespace name 'dialog' does not exist in the namespace 'DefaultsSwitcher' (are you missing an assembly reference?) E:\Apps\StoreHelper\StoreHelper\mainWindow.cs   84  25  StoreHelper

Which is the problem? P.S. I want these two projects to pe .exe files after building.

The code in DefaultsSwitcher:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using StoreHelperLib.Options;

namespace DefaultsSwitcher {
    public class dialog : Form {
        public dialog() {
            var options = new iniHelper();
            if (!File.Exists( "settings.ini" )) {
                StreamWriter settings = new StreamWriter( "settings.ini" );
                settings.Close();
            }

            options.Load( "settings.ini" );
            options.AddSection( "Application" );
            options.SetKeyValue( "Application", "firstRun", "true" );
            options.SetKeyValue( "Application", "startGuide", "false" );

            options.Save( "settings.ini" );
            InitializeComponent();
        }
    }
}

3 Answers3

1

Is there any communication between the apps, or are you just trying to start the one app from the other app? If the latter, use System.Diagnostics.Process and have Windows run the other EXE file seperately.

http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx

This also means that you can have both apps be able to start the other because there would not be a circular dependency.

Steven Hunt
  • 2,321
  • 19
  • 18
  • I don't know yet if any dependency will exist. But if it will exist, witch is the method for these two apps to comunicate each other? –  Sep 14 '12 at 12:09
  • Here are some suggestions: http://stackoverflow.com/questions/528652/what-is-the-simplest-method-of-inter-process-communication-between-2-c-sharp-pro – Steven Hunt Sep 14 '12 at 12:12
1

I think that you have miss to include the child Project to his parent. To do this : Right clic on Reference folder in StoreHelper project and clic on Add Reference. Finally choose DefaultsSwitcher project.

Now the DefaultsSwitcher namespace must be accesible from the StoreHelper project

Franck Charlier
  • 414
  • 4
  • 17
  • I have already added, read the comments on my question, but thank you for attentioning me. –  Sep 14 '12 at 17:30
0

I found a solution for my problem to keep both projects output to EXE. I have just to use:

public partial class dialog