I'm using csc/csc2.exe to manually compile an application. I need to reference .NET 3.5 dlls, however it seems that the compiler automatically adds .NET 4.0 dlls as well (which is causing a conflict).
I'm manually referencing the desired version of mscorlib, and other system dlls. Compilation from within Visual Studio succeeds, however compilation of the same response file manually from command prompt fails.
/nostdlib+
/platform:AnyCPU
/errorendlocation
/highentropyva-
/reference:"C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll"
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll"
/reference:"C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll"
/debug+
/debug:full
/out:obj\Debug\Target.exe
/ruleset:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset"
/target:exe
/utf8output
Program.cs Properties\AssemblyInfo.cs
I'm getting the following errors for every referenced assembly:
error CS1703: Multiple assemblies with equivalent identity have been imported: 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.dll' and 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll'. Remove one of the duplicate references.
What causes the compiler to include .NET 4.0 dlls, and what can I do to prevent it from including them?
UPDATE: I cannot use MSBUILD, because I already have a response file (not a project file) from an application. The application used an outdated version of a compiler, and I'm trying to replace their compiler with a newer one that supports C#6. I've successfully done this task with Mono MCS compiler, but cannot get the same to work with Roslyn. I cannot use the MCS compiler, because it doesn't yet support all of C#6 features.
The only way to use MSBUILD would be to parse the response file back into a C# project file. This seems like over-engineering to me.