Then we do not need to know the 10 commandments?
How about the two great commandments?
"What shall we say then? Is the law sin? Certainly not! On the contrary, I would not have known sin except through the law" (Romans 7:7).
I'm sure we'll differ on this, but Paul is relating how things had worked under the Law just before Paul this side of Christ's finished work on the Cross.
In this, aspects of what Paul is talking about in Romans 7 are found throughout Romans 2 thru 8.
It is based on all that information that he relates what he is relating in Romans 7.
How that the Law is not sin, because it was the Law that brought one to the awareness of indwelling sin, that one might come to the realization of how utterly hopeless one is, that one might turn to Christ.
Now, although Galatians was written around about ten years or so before Romans, it is based on the doctrine or teaching that Paul had been preaching and teaching all along that he would only later write down as Romans.
Note part of Galatians 3:
21 Is the law then against the promises of God? God forbid: for if there had been a law given which could have given life, verily righteousness should have been by the law.
The purpose of the Law then?
3:22 But the scripture hath concluded all under sin, that the promise by faith of Jesus Christ might be given to them that believe.
3:23 But before faith came, we were kept under the law, shut up unto the faith which should afterwards be revealed.
3:24 Wherefore the law was our schoolmaster to bring us unto Christ, that we might be justified by faith.
3:25 But after that faith is come, we are no longer under a schoolmaster.
3:26 For ye are all the children of God by faith in Christ Jesus.
Paul is going back and forth between both systems, and how each works, by his "we" and "ye."
So, no, the Law is not sin (transgression, a person or thing at odds with God). It is not against God's will.
Rather, His will through the Law - "the Scripture hath concluded all under sin" has been fulfilled, see Romans 3 and Romans 10.