This might take a little more time that using canned mushroom soup, but the difference is definitely worth the effort!
Salt and pepper
1 1/2 pounds green beans, trimmed
3 tablespoons butter
2 shallots, chopped
1/2 pound button mushrooms, chopped
3 tablespoons flour
1 cup chicken stock
1 cup half-and-half
1 can fried onions
Preheat the oven to 375 degrees
Bring a large pot of water to a rolling boil, season with 2 tablespoons salt, and blanch the green beans for 5 minutes. Shock the green beans in a bowl filled with ice water, then remove and set aside to dry.
Melt the butter in a large cast-iron pan or Dutch oven over medium-high heat. Add the shallots and cook until lightly browned. Add the mushrooms and some salt and pepper, and cook until just softened. Add the flour and stir to coat the mushrooms and shallots. Add the chicken stock, whisking vigorously to smooth out any lumps. Whisk in the half-and-half. Bring to a simmer and cook for 3 minutes. Check the seasoning and adjust with more salt and pepper as needed. Add the green beans, then pour the mixture into a 9-by-13-inch baking dish.
Bake for 30 minutes. During the last 5 minutes of cooking, sprinkle with the fried onions for some extra crunch.