You have to have both width and height fixed internally.
I do it like this.
On initialization game creates the render target of the required size.
Render loop uses this render target for all the drawing, and as a last step it draws this render target to the screen.
This way there is no worrying about scaling during the game.
There are multiple ways to deal with aspect ratios. It depends on what you want to do with the blank space.
I calculate the scaling ratio like this:
float widthScale = ActualScreenWidth / (float)RequiredWidth;
float heightScale = ActualScreenHeight / (float)RequiredHeight;
Now only one of these values can be used for scaling if you want uniform aspect ratio.
If you want all content to be on the screen:
float scale = Math.Min(widthScale, heightScale);
From here:
int scaledWidth = (int)(scale * RequiredWidth);
int scaledHeight = (int)(scale * RequiredHeight);