There are several answers to questions about railguns/coilguns right here on worldbuilding stack exchange:
Is there any advantage in a railgun/coilgun having multiple barrels?
What's more viable as futuristic infantry weapons, rail/coilguns or laser rifles?
Feasibility of coilgun system for sub-luminar interplanetary transport
What are the advantages of a coilgun v.s. a railgun?
I can also point you to the ever useful Atomic Rockets site, where you can find the equations needed to exactly answer your questions.
The shorter answer is you will need to define rather carefully what it is you want to do. An infantry weapon used as a long range "battle rifle" (semi automatic, relatively large calibre [7mm+]) will have different requirements from something resembling a current military assault rifle (selective fire, 6mm - calibre projectiles). An anti material rifle capable of damaging buildings or vehicles will be a much different beast.
The requirements are then going to drive your power system and then you can look at things like heat rejection, power coupling (a lose connector will really spoil any grunt's day....) and so on. Coilguns are electromagnetic weapons as well, and you can compare the efficiencies between the two types of weapons:
Look at Atomic rockets and see what happens when you try to fire a dime sized projectile at 100G out of a 100km long barrel...
Here's a quick method to estimate what kind of performance you can get out of a coilgun. Some folks here might find it interesting.
First, decide on the efficiency of your coilgun. Coilguns are linear brushless electric motors, and brushless electric motors have demonstrated efficiencies of 90% to 95%. Superconductive electric motors might have efficiencies of 98% to 99%. Denote this as a decimal, and call it e; that is e = 0.9 to e = 0.95.
Next, decide on the length and radius of your projectile. Decide on what your projectile is made of and find its mass
mass = density * length * radius2 * &pi (and remember to use consistent units).
Also find the projectile cross-sectional area
area = radius2 * π
Decide how fast you want your projectile to be going and find its final kinetic energy
kinetic energy = 0.5 * mass * velocity2 (again remember to use consistent units).
Given the efficiency of your coilgun, you can find out how much your projectile heats up. You might figure that half of the wasted energy goes into the projectile, and thus your projectile will gain a heat energy of
heat energy = 0.5 * (1/e - 1) * (kinetic energy)
Look up the specific heat of the material your projectile is made of, commonly called C. Then your projectile reaches a temperature of
projectile temperature = (heat energy) / (C * mass) (again make sure your units are consistent).
If you are using a synchronous coilgun with a permanent magnet in the projectile, this temperature needs to be less than the Curie point or the projectile will become non-magnetic. If your coilgun projectile is made of superconductors and you are using Meissner effect repulsion, this temperature will need to be less than the critical temperature of the superconductor or your superconductor will become non-superconducting. If you are using an asynchronous coilgun which uses inductive forces on conductive loops, this temperature will need to be less than the melting temperature of your projectile. If the temperature is too high, you will either need to use a material that can handle higher temperatures, make the coilgun more efficient, or accept a lower velocity for the projectile.
Decide the maximum magnetic field your coilgun can handle. If you are using a synchronous coilgun with permanent magnets (probably in the projectile, with the field coils along the barrel) you are limited by a saturation field of around 0.2 to 2 tesla beyond which your efficiency falls off rapidly. If you are using superconductors, your field is limited by the critical field of the superconductor. For conventional BCS-type superconductors this limits you to fields of several tens of tesla or less, for high Tc superconductors you might be able to get to 100 to 200 tesla. If using an asynchronous coilgun that uses induction to launch normally conductive projectiles there is no obvious physical upper limit to the magnetic field strength, although high field strengths will require massive bracing to keep the barrel from exploding.
Now assume that the barrel is filled with field, and that the projectile sweeps the field out of the barrel, turning the field energy into kinetic energy (this is not actually how coilguns work, but it gives the physical upper limit based on energy conservation). The energy density is about 400 kJ/m3/T2 times the square of the magnetic field strength (398,098 J/m3/T2 to six significant figures). Call this value K
K = 400 kJ/m3/T2
You now know the volume needed in the barrel based on how much energy the projectile ends up with
volume = kinetic energy / (K * (magnetic field)2)
Since you know the cross-sectional area of the projectile and thus of the barrel, you know how long the barrel needs to be
length = volume / area
If the barrel is unacceptably long, you will either need to figure out how to get a stronger field in the barrel, make the projectile shorter (if you do the math, you can see that the barrel length will be a multiple of the projectile length for a given field, material, efficiency, and final velocity) or make due with a lower velocity of the projectile.
As an example, suppose we have a synchronous coilgun, and that the coilgun can generate 1 tesla fields (a good number that will not saturate the ferromagnet). Our presumed ferromagnet is probably mostly iron, with about 8000 kg/m3. To reach 100 km/s, you will need 40 TJ per cubic meter of projectile. Since this is 100 million times the energy density of the field, you will need the projectile to sweep out 100 million times its volume in order to accelerate up to the desired speed. This means you need an accelerating track 100 million times the length of your projectile. If the projectile is the size of a dime, with 1mm thickness, you will need a 100 km long track. If 2.5% of the energy goes into the projectile as heat as a result of inefficiencies, you get 100 GJ of heat per cubic meter of projectile, or 12 MJ/kg. This is three times the specific energy liberated by detonating high explosives, so you can expect your projectile to explode like a bomb inside your coilgun barrel. Consequently, this appears to be an unworkable design.