0

我在 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
4

1 回答 1

0

我不确定我是否完全了解您的情况,但这里有一个可以遵循的策略:

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

首先处理您的依赖项目:

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

现在处理您的 GUI 项目:

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

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

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

  6. 编译。
于 2012-07-25T22:34:34.343 回答