void Configure(ConfigureWindowModel model, Project project) { var directoryInfo = fullPathResolver.GetFullPath(model.ToolsDirectory, project); var targetFile = new FileInfo(Path.Combine(directoryInfo.FullName, "NotifyPropertyWeaverMsBuildTask.dll")); if (!targetFile.Exists || VersionChecker.IsVersionNewer(targetFile)) { if (!fileExporter.ExportTask(directoryInfo)) { taskFileReplacer.AddFile(directoryInfo); } } if (model.IncludeAttributeAssembly) { var frameworkType = FrameworkTypeReader.GetFrameworkType(project.FullName); fileExporter.ExportAttribute(fullPathResolver.GetFullPath(model.DependenciesDirectory, project), frameworkType); } var defaulter = new Defaulter(); var projectInjector = new NotifyPropertyWeaverProjectInjector { ProjectFile = project.FullName }; defaulter.FromModel(projectInjector, model); projectInjector.Execute(); }
public void WithExistingWeaving() { var sourceProjectFile = new FileInfo(@"TestProjects\ProjectWithWeaving.csproj"); var targetFileInfo = sourceProjectFile.CopyTo(sourceProjectFile.FullName + "ProjectInjectorTests", true); try { var injector = new NotifyPropertyWeaverProjectInjector { CheckForEquality = false, CheckForIsChanged = false, DependenciesDirectory = @"Lib2\", ToolsDirectory = @"Tools2\", EventInvokerName = "OnPropertyChanged2", ProjectFile = targetFileInfo.FullName, IncludeAttributeAssembly = true, ProcessFields = false, Target = "AfterCompile", TargetPath = "Foo2.dll", TryToWeaveAllTypes = false, MessageImportance = MessageImportance.High, }; injector.Execute(); var reader = new ProjectReader(targetFileInfo.FullName); Assert.IsFalse(reader.CheckForEquality.Value); Assert.IsFalse(reader.CheckForIsChanged.Value); Assert.IsFalse(reader.TryToWeaveAllTypes.Value); Assert.IsFalse(reader.ProcessFields.Value); Assert.AreEqual("OnPropertyChanged2", reader.EventInvokerName); Assert.AreEqual("Foo2.dll", reader.TargetPath); Assert.AreEqual(@"Lib2\", reader.DependenciesDirectory); Assert.AreEqual(@"Tools2\", reader.ToolsDirectory); Assert.AreEqual(MessageImportance.High, reader.MessageImportance); } finally { targetFileInfo.Delete(); } }