In Visual Studio 2013, I was able to exclude some .cs file from being compiled by using a compiler constant and modifying the project's .csproj file.
Something like this:
-- myproject.csproj
<PropertyGroup>
...
<DefineConstants>MY_COMPILER_CONSTANT</DevineConstants>
...
</PropertyGroup>
<ItemGroup>
...
<Compile Include="myproject\myfile.cs" Condition="'$(Configuration)' != 'MY_COMPILER_CONSTANT'" />
...
</ItemGroup>
Then my project completely excluded this myfile.cs from being compiled, allowing me to avoid some nasty errors.
But now I'm trying to migrate my project environment to Visual Studio 2015.
I could easily figure out how to add a compiler constant to a VS2015 project, but still trying to figure out how to exclude a file from being compiled.
My project.json currently looks something like this:
{
"frameworks": {
"net451": {
"dependencies": { }
}
},
"dependencies": {
...
},
"buildOptions": {
"define": [ "MY_COMPILER_CONSTANT" ]
}
}
Adding a file for compilation seems straight forward. I presume that it has to do something with the "compile" configuration variable in buildOptions. What do I need to add to make the compiler to ignore myfile.cs on build?