2012-07-25 145 views
0

我在VS2010中有兩個項目。第一個是依賴於第二個具有DLL的GUI。 我沒有正確命名它們。Visual Studio 2010 - 更改從屬項目上的exe文件名稱

現在我想改變兩者的名稱,我可以通過更改程序集來更改第二個項目上的名稱/ dll名稱。但是當我第一次改變裝配時,它不起作用。編譯失敗。如何更改兩者的exe名稱/原始文件名稱?

ActionLog是我第一個用於GUI的項目,我正在嘗試將它重命名爲ActionLog1。現在就進行測試。用xml定義的GUI。

------ Build started: Project: ActionLog, Configuration: Debug x86 ------ 
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(24,13): error CS0103: The name 'InitializeComponent' does not exist in the current context 
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(26,18): error CS1061: 'ActionLog.MainWindow' does not contain a definition for 'SearchBox' and no extension method 'SearchBox' accepting a first argument of type 'ActionLog.MainWindow' could be found (are you missing a using directive or an assembly reference?) 
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(27,18): error CS1061: 'ActionLog.MainWindow' does not contain a definition for 'AllContacts' and no extension method 'AllContacts' accepting a first argument of type 'ActionLog.MainWindow' could be found (are you missing a using directive or an assembly reference?) 
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(74,91): error CS1061: 'ActionLog.MainWindow' does not contain a definition for 'SearchBox' and no extension method 'SearchBox' accepting a first argument of type 'ActionLog.MainWindow' could be found (are you missing a using directive or an assembly reference?) 
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(89,13): error CS0103: The name 'ContactsList' does not exist in the current context 
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(97,17): error CS0103: The name 'ContactsList' does not exist in the current context 
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(121,13): error CS0103: The name 'ButtonClose' does not exist in the current context 
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(126,13): error CS0103: The name 'ButtonClose' does not exist in the current context 
c:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml(240,134): error CS1061: 'ActionLog1.MainWindow' does not contain a definition for 'Grid_MouseLeftButtonDown' and no extension method 'Grid_MouseLeftButtonDown' accepting a first argument of type 'ActionLog1.MainWindow' could be found (are you missing a using directive or an assembly reference?) 
c:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml(241,134): error CS1061: 'ActionLog1.MainWindow' does not contain a definition for 'Grid_MouseLeftButtonDown' and no extension method 'Grid_MouseLeftButtonDown' accepting a first argument of type 'ActionLog1.MainWindow' could be found (are you missing a using directive or an assembly reference?) 
c:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml(242,107): error CS1061: 'ActionLog1.MainWindow' does not contain a definition for 'ButtonClose_MouseLeftButtonDown' and no extension method 'ButtonClose_MouseLeftButtonDown' accepting a first argument of type 'ActionLog1.MainWindow' could be found (are you missing a using directive or an assembly reference?) 
c:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml(242,92): error CS1061: 'ActionLog1.MainWindow' does not contain a definition for 'ButtonClose_MouseEnter' and no extension method 'ButtonClose_MouseEnter' accepting a first argument of type 'ActionLog1.MainWindow' could be found (are you missing a using directive or an assembly reference?) 
c:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml(242,92): error CS1061: 'ActionLog1.MainWindow' does not contain a definition for 'ButtonClose_MouseLeave' and no extension method 'ButtonClose_MouseLeave' accepting a first argument of type 'ActionLog1.MainWindow' could be found (are you missing a using directive or an assembly reference?) 
c:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml(244,131): error CS1061: 'ActionLog1.MainWindow' does not contain a definition for 'Grid_MouseLeftButtonDown' and no extension method 'Grid_MouseLeftButtonDown' accepting a first argument of type 'ActionLog1.MainWindow' could be found (are you missing a using directive or an assembly reference?) 

Compile complete -- 14 errors, 0 warnings 
+0

'編譯失敗'有點模糊。什麼是確切的錯誤信息? – Steve 2012-07-25 21:58:49

+0

@Steve給我2,會在我的問題中添加實際的錯誤日誌和一些代碼。 – 2012-07-25 22:06:40

回答

0

我不知道我究竟瞭解你的情況,但這裏是跟隨戰略:

在開始之前,不過,請先確認您備份整體解決方案!首先對你的依賴項目(或者更好的是,使用版本控制。)

工作:

  1. 重命名該項目。
  2. 轉到屬性/應用程序並重命名「程序集名稱」和「默認名稱空間」以匹配項目名稱。
  3. 爲您的整個項目做一個查找/替換,用您的新名稱空間替換原始名稱空間的所有實例(僅使用「整個單詞」和「匹配大小寫」以保證安全)。
  4. 編譯。

現在在你的GUI項目工作:

  1. 找到引用您的原始依賴項目的引用文件夾並將其刪除。
  2. 重命名項目。
  3. 轉到屬性/應用程序並重命名「程序集名稱」和「默認名稱空間」以匹配項目名稱。
  4. 右鍵單擊References文件夾,然後重新添加對已重命名的相關項目的引用。
  5. 做兩個查找/替換操作爲您的整個項目:

    • 首先應該更換的命名空間爲您與新的命名空間相關的項目。

    • 第二個應該用新的名稱空間替換GUI項目的名稱空間。

  6. 編譯。
+0

試過這個還是有問題的。爲什麼會在'InitializeComponent()'出錯? '錯誤CS0103:名稱'InitializeComponent'在當前上下文中不存在' – 2012-07-25 23:02:35

+0

聽起來好像你有一個UserControl或Window有一個命名空間問題或在代碼隱藏中缺少InitializeComponent。也許您的某個類在您找到/替換以更正名稱空間時意外重命名?類名稱需要匹配Window/UserControl的'x:Class'聲明中的名稱。 – devuxer 2012-07-25 23:18:37

相關問題