jskeezy
jskeezy

Reputation: 3

I added a class then didn't need it, now it won't build my project without it. How do I fix this?

I'm building a WPF project in Visual Studio and I added a class using the File>add class technique with VS. I ended up realizing I didn't need this new class so I deleted the .cs file that it created. However, now when I try to build the project, I get an error (failure to find source file x.cs). What do I need to do so that the build doesn't expect to find the x.cs file when building?

Upvotes: 0

Views: 77

Answers (1)

Maciej Los
Maciej Los

Reputation: 8591

Depending on situation there's few ways to achieve that:

Removing

To remove an item or project

  1. In Solution Explorer, select the item you want to remove.
  2. On the Edit menu, select Remove.

Deleting

To permanently delete an item

  1. In Solution Explorer, select the item you want to delete.
  2. On the Edit menu, select Delete.

Excluding

To temporarily exclude an item that represents a file

  1. In Solution Explorer, select the item you want to exclude.
  2. On the Project menu, select Exclude From Project.

Excluding Items from Deployment Projects

To exclude an item from a deployment project

  1. In Solution Explorer, select the file you want to exclude.
  2. On the Solution Explorer toolbar, select Properties.

Unloading

To temporarily unload a project from a solution

  1. In Solution Explorer, select the project you want to unload.
  2. On the Project menu, select Unload Project.

More at: Visual Studio: How to: Remove, Delete, and Exclude Items (MSDN)

Upvotes: 3

Related Questions