Visual Studio 2010 - 在依赖项目上更改exe文件名

时间:2012-07-25 21:54:54

标签: visual-studio-2010

我在VS2010中有两个项目。第一个是依赖于具有DLL的第二个GUI。 我没有正确命名它们时犯了一个错误。

现在我想更改两者的名称,我可以通过更改程序集来更改第二个项目的名称/ 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

1 个答案:

答案 0 :(得分:0)

我不确定我是否完全理解你的情况,但这是一个遵循的策略:

在开始之前,请确保备份整个解决方案! (或者更好的是,使用版本控制。)

首先处理您的依赖项目:

  1. 重命名该项目。
  2. 转到“属性/应用程序”并重命名“程序集名称”和“默认名称空间”以匹配项目名称。
  3. 为整个项目执行查找/替换,用新命名空间替换原始命名空间的所有实例(使用“仅限整个单词”和“匹配大小写”以确保安全)。
  4. 编译。
  5. 现在处理您的GUI项目:

    1. 在References文件夹中找到对原始相关项目的引用,然后将其删除。
    2. 重命名该项目。
    3. 转到“属性/应用程序”并重命名“程序集名称”和“默认名称空间”以匹配项目名称。
    4. 右键单击References文件夹,然后重新添加对重命名的依赖项目的引用。
    5. 为整个项目执行两次查找/替换操作:

      • 第一个应该使用新命名空间替换依赖项目的命名空间。

      • 第二个应该用新命名空间替换GUI项目的命名空间。

    6. 编译。