2012-09-14 2 views
0

내 솔루션 프로젝트 : StoreHelperDefaultsSwitcher입니다. 둘 다 Windows 실행 파일을 만들어야합니다 (출력은 응용 프로그램입니다).두 개의 WinForms 프로젝트 결합

이제 우리는 StoreHelper에 있습니다. 내가하려고 할 때

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

는 코드 편집기는 밑줄로 오류를 표시하지 않지만, : 파일의 맨 위에

: 이것은 내 코드입니다

using DefaultsSwitcher; 

그리고 파일에 빌드하려면 컴파일러에서 다음 오류를 말하십시오.

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 

어느 것이 문제입니까? 추신 나는이 두 프로젝트를 빌드 한 후 파일 .exe에 넣기를 원한다.

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(); 
     } 
    } 
} 
+1

로컬로 복사 하시겠습니까? 그러면 StoreHelper.exe 옆에'DefaultSwitcher.exe'가 복사됩니다. 하지만 당신은 단지 논리를 DLL로 옮기지 않을 수 있습니까? – Reniuz

+1

'DefaultsSwitcher'를'StoreHelper'의 참조에 추가했습니다 –

+0

하지만 그 참조 속성 인 Copy Local은 true로 설정되어 있습니까? – Reniuz

답변

1

는 응용 프로그램 사이의 통신이 있습니까, 아니면 그냥 다른 응용 프로그램에서 하나의 응용 프로그램을 시작하려고 :

DefaultsSwitcher의 코드

? 후자의 경우 System.Diagnostics.Process를 사용하고 Windows에서 다른 EXE 파일을 별도로 실행하게하십시오.

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

이 또한 순환 종속성이 없을 것이기 때문에 두 응용 프로그램이 다른를 시작할 수있을 수 있다는 것을 의미한다.

+0

종속성이 있는지 아직 모르겠습니다. 그러나 그것이 존재한다면, 마녀는이 두 앱이 서로를 서로 사귈 수있는 방법일까요? –

+0

다음은 몇 가지 제안 사항입니다. http://stackoverflow.com/questions/528652/what-is-the-simplest-method-of-inter-process-communication-between-2-c-sharp-pro –

1

부모 프로젝트에 자녀 프로젝트를 포함시키지 않으 셨습니다. 이렇게하려면 StoreHelper 프로젝트의 참조 폴더에서 오른쪽 클릭하고 참조 추가를 클릭하십시오. 마지막으로 DefaultsSwitcher 프로젝트를 선택하십시오.

이제 DefaultsSwitcher 네임 스페이스 내가 EXE에 두 프로젝트 출력을 유지하기 위해 내 문제에 대한 해결책을 발견 StoreHelper 프로젝트

+0

나는 이미 내 질문에 대한 의견을 읽지 만, 나를주의 해 주셔서 감사합니다. –

0

에서 accesible해야합니다. 사용할 내용 :

public partial class dialog 
관련 문제