public void adding_an_assembly_reference() { // SAMPLE: assembly-reference var project = CsProjFile.CreateAtLocation("MyProject.csproj", "MyProject"); project.Add(new AssemblyReference("MyOtherLibrary") { HintPath = "../packages/MyOtherLibrary/lib/MyOtherLibrary.dll", SpecificVersion = false }); // Find an existing reference by assembly name var reference = project.Find <AssemblyReference>("MyOtherLibrary"); // Remove a reference by assembly name project.Remove <AssemblyReference>("ObsoleteLibrary"); // or remove by the object project.Remove(reference); // Access all the references to the project. // This structure closely mimics the MsBuild schema, so the assembly name // is "Include" project.All <AssemblyReference>().Each(x => Debug.WriteLine(x.Include)); // ENDSAMPLE reference.HintPath.ShouldEqual("../packages/MyOtherLibrary/lib/MyOtherLibrary.dll"); }
public void can_write_and_read_Aliases() { var project = CsProjFile.CreateAtLocation("Foo.csproj", "Foo"); var assemblyReference = new AssemblyReference("Foo") { Aliases = "some alias" }; project.Add <AssemblyReference>(assemblyReference); project.Save(); var project2 = CsProjFile.LoadFrom("Foo.csproj"); project2.Find <AssemblyReference>("Foo") .Aliases.ShouldEqual("some alias"); }
public void can_write_and_read_fusion_name() { var project = CsProjFile.CreateAtLocation("Foo.csproj", "Foo"); var assemblyReference = new AssemblyReference("Foo") { FusionName = "some fusion" }; project.Add <AssemblyReference>(assemblyReference); project.Save(); var project2 = CsProjFile.LoadFrom("Foo.csproj"); project2.Find <AssemblyReference>("Foo") .FusionName.ShouldEqual("some fusion"); }
public void can_write_and_read_Private_null() { var project = CsProjFile.CreateAtLocation("Foo.csproj", "Foo"); var assemblyReference = new AssemblyReference("Foo") { Private = null }; project.Add <AssemblyReference>(assemblyReference); project.Save(); var project2 = CsProjFile.LoadFrom("Foo.csproj"); project2.Find <AssemblyReference>("Foo") .Private.ShouldBeNull(); }
public void can_write_and_read_SpecificVersion_false() { var project = CsProjFile.CreateAtLocation("Foo.csproj", "Foo"); var assemblyReference = new AssemblyReference("Foo") { SpecificVersion = false }; project.Add <AssemblyReference>(assemblyReference); project.Save(); var project2 = CsProjFile.LoadFrom("Foo.csproj"); project2.Find <AssemblyReference>("Foo") .SpecificVersion.Value.ShouldBeFalse(); }
public void creating_a_new_csprojectfile_create_a_guid() { var project = CsProjFile.CreateAtLocation("Foo.AssemblyName.csproj", "Foo.AssemblyName"); project.ProjectGuid.ShouldNotEqual(Guid.Empty); }