Пример #1
0
        public void InjectReference(SourceCodeInfo sourceCodeInfo, string projectFileName)
        {
            string prdata = sourceCodeInfo.GetContentsOfFileAtRoot(projectFileName);

            string prPath = @"/Users/rohan/code/codevine-recorder/CodeVineRecorder/CodeVineRecorder.csproj";

            string replaceData = string.Format("<ItemGroup><ProjectReference Include=\"{0}\" /></ItemGroup></Project>", prPath);

            var replacedStr = prdata.Replace("</Project>", replaceData);

            sourceCodeInfo.SetContentsOfFileAtRoot(projectFileName, replacedStr);
        }
        public void InjectReference(SourceCodeInfo sourceCodeInfo, string projectFileName)
        {
            string prdata = sourceCodeInfo.GetContentsOfFileAtRoot(projectFileName);

            if (prdata.Contains("CodeVineRecorder.dll"))
            {
                log.InfoFormat("Project {0} already contains the hooks, skipping injection of reference", projectFileName);
                return;
            }
            var replacedStr = ReplaceLastOccurrence(prdata, "</Project>", CODEVINE_REFERENCE_STR);

            sourceCodeInfo.SetContentsOfFileAtRoot(projectFileName, replacedStr);
        }