Avatar ·

构建错误:在WPF项目中找不到元数据文件'.dll'

大家好!我是C#和WPF的新手(根据一本针对Visual Studio 2008、C# 3.0的旧教程学习)。我有一个解决方案,其中包含两个项目:主WPF项目(MyApp)和一个类库(MyLibrary)。在MyApp中,我添加了对MyLibrary的引用,但当我尝试构建解决方案时,收到以下错误: "Metadata file 'C:\Projects\MyApp\MyLibrary\bin\Debug\MyLibrary.dll' could not be found" 以下是MyLibrary中的代码(一个简单的类): ```csharp using System; namespace MyLibrary { public class Calculator { public int Add(int a, int b) { return a + b; } } } ``` 在MyApp中,我尝试使用这个类: ```csharp using System; using System.Windows; using MyLibrary; namespace MyApp { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); var calc = new Calculator(); int result = calc.Add(5, 3); MessageBox.Show(res