1
我目前在開發基於文本的遊戲的visual studio中工作。我和一個類有一個命名空間衝突。
我有一個類名是Clothing
和命名空間,它也被命名爲Clothing。爲了解決這個問題,我重命名了名字空間衣服而不是衣服,然後所有的戲劇開始。我的csproj文件沒有更新文件夾中的名稱空間引用,只要我嘗試構建,就會得到以下錯誤。Visual Studio中的類包含錯誤
[Failure] Could not find file '...\src\Items\Equipment\Apparel\Clothing\Shirts\Shirt.cs'.
[Failure] Could not find file '...\src\Items\Equipment\Apparel\Clothing\ClothingEnum.cs'.
[Failure] Could not find file '...\src\Items\Equipment\Apparel\Clothing\Cloaks\Cloak.cs'.
[Failure] Could not find file '...\src\Items\Equipment\Apparel\Clothing\Boots\JackBoot.cs'.
...
如果我查看這些目錄中的文件存在,但是是空的。實際文件位於... \ src \ Items \ Equipment \ Apparel \ Clothes \ Boots ...並且它們包含在csproj文件中。但這些文件也在那裏。
實質上,我問的是如何從csproj文件中刪除這些未使用的引用/依賴關係/無論它們是什麼。
手動刪除csproj文件中的xml引用只會導致我的項目無法加載。
這個工作謝謝。我認爲名稱空間和文件夾名稱已鏈接。 –
VS使命名空間(當它創建.cs文件時)遵循文件夾結構以實現可用性和可讀性,但並不強制要這樣做。在許多人工作的一些大型項目中,這一點更爲重要。 –