public void Dontlink_Allow_ReadonlyAssembly() { var sb = new StringBuilder(); RunMMPTest(tmpDir => { // build b.dll sb.Clear(); string assemblyPath = string.Format("{0}/b.dll", tmpDir); sb.AppendFormat("-target:library -debug -out:{0} {1}/b.cs", assemblyPath, tmpDir); File.WriteAllText(Path.Combine(tmpDir, "b.cs"), "public class B { }"); TI.RunAndAssert("/Library/Frameworks/Mono.framework/Commands/mcs", sb, "b"); File.SetAttributes(assemblyPath, FileAttributes.ReadOnly); File.SetAttributes(assemblyPath + ".mdb", FileAttributes.ReadOnly); // build project referencing a.dll TI.UnifiedTestConfig test = new TI.UnifiedTestConfig(tmpDir) { References = string.Format(" <Reference Include=\"b\" > <HintPath>{0}</HintPath> </Reference> ", assemblyPath), TestCode = "System.Console.WriteLine (typeof (B));", }; TI.BuildUnifiedExecutable(test, shouldFail: false); test.CSProjConfig = "<LinkMode>SdkOnly</LinkMode>"; TI.BuildUnifiedExecutable(test, shouldFail: false); }); }
public void Dontlink_AllowsUnresolvableReferences() { var sb = new StringBuilder(); RunMMPTest(tmpDir => { // build b.dll sb.Clear(); sb.AppendFormat("-target:library -out:{0}/b.dll {0}/b.cs", tmpDir); File.WriteAllText(Path.Combine(tmpDir, "b.cs"), "public class B { }"); TI.RunAndAssert("/Library/Frameworks/Mono.framework/Commands/mcs", sb, "b"); // build a.dll sb.Clear(); sb.AppendFormat("-target:library -out:{0}/a.dll {0}/a.cs -r:{0}/b.dll", tmpDir); File.WriteAllText(Path.Combine(tmpDir, "a.cs"), "public class A { public A () { System.Console.WriteLine (typeof (B)); }}"); TI.RunAndAssert("/Library/Frameworks/Mono.framework/Commands/mcs", sb, "a"); File.Delete(Path.Combine(tmpDir, "b.dll")); // build project referencing a.dll TI.UnifiedTestConfig test = new TI.UnifiedTestConfig(tmpDir) { References = string.Format(" <Reference Include=\"a\" > <HintPath>{0}/a.dll</HintPath> </Reference> ", tmpDir), TestCode = "System.Console.WriteLine (typeof (A));", }; TI.BuildUnifiedExecutable(test, shouldFail: false); }); }