2012-07-25 101 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

相关问题