Preheat the oven to 350°F (175°C). Grease and flour a 9x13-inch baking pan.
In a large mixing bowl, combine the flour, sugar, baking powder, baking soda, cinnamon, and salt. Whisk until well combined.
In another bowl, whisk together the vegetable oil and eggs until smooth. Stir in the grated carrots, crushed pineapple, walnuts, and raisins (if using).
Add the wet ingredients to the dry ingredients and mix until just combined. Do not overmix.
Pour the batter into the prepared baking pan and spread it evenly. Bake for 30-35 minutes, or until a toothpick inserted in the center comes out clean.
Allow the cake to cool in the pan for about 15 minutes, then transfer it to a wire rack to cool completely.
While the cake cools, prepare the frosting. In a mixing bowl, beat the softened cream cheese and butter together until smooth and creamy.
Gradually add the powdered sugar and vanilla extract, mixing until well combined. If the frosting is too thick, add milk one tablespoon at a time until desired consistency is reached.
Once the cake is completely cool, spread the cream cheese frosting evenly over the top. Cut into bars and serve.