public void Write() { TemplatedWriter propsWriter = new TemplatedWriter(propsTemplateFile) .Write(ProjectGuidToken, Guid) .Write(MSBuildForUnityVersionToken, MSBuildForUnityVersion.ToString()); foreach (ProjectReference projectReference in References) { TemplatedWriter referenceWriter = propsWriter.CreateWriterFor(ProjectReferenceTemplate) .Write(ProjectReferenceTemplate_ReferenceToken, projectReference.ReferencePath.LocalPath) .Write(ProjectReferenceTemplate_ConditionToken, projectReference.Condition ?? string.Empty); if (projectReference.IsGenerated) { // Creating this is sufficient for the template to be included in the output referenceWriter.CreateWriterFor(PrivateReferenceTemplate); } } propsWriter.Export(propsExportPath); // Don't overwrite primary export path, as that is the file that is allowed to be edited if (!File.Exists(primaryExportPath.FullName)) { new TemplatedWriter(primaryTemplateFile).Export(primaryExportPath); } new TemplatedWriter(targetsTemplateFile).Export(targetsExportPath); }
public void Write() { TemplatedWriter writer = new TemplatedWriter(fileTemplate); writer.Write(MSBuildForUnityVersionToken, MSBuildForUnityVersion.ToString()); writer.Write(UnityMajorVersionToken, UnityMajorVersion); writer.Write(UnityMinorVersionToken, UnityMinorVersion); writer.Write(UnityEditorInstallPathToken, UnityEditorInstallPath.FullName); writer.Write(CurrentUnityPlatformToken, CurrentUnityPlatform); writer.Write(CurrentTargetFrameworkToken, CurrentTargetFramework); writer.Write(UnityProjectAssetsDirectoryToken, UnityProjectAssetsDirectory.FullName); writer.Write(GeneratedOutputDirectoryToken, GeneratedProjectOutputPath.FullName); writer.Export(exportPath); }