Reputation: 10827
In C++ you are able to compile files that are not included in the solution, with c# this is not the case.
Is there a way to keep a file in a project but not have the standard SCCI provider attempt to keep checking in the file?
Essentially what we are wanting to do is to create "by developer" code ability similar to how we code in c++, this allows for us to let our developers do nightly check-ins with pseudo code and by-developer utilities.
#ifdef (TOM)
#include "Tom.h";
#endif
EDIT I don't want to create new configurations in the solution file either, I want these to be as machine specific as possible, without source control bindings to the user on the file/setting.
Upvotes: 1
Views: 632
Reputation: 10827
Well, it seems after working off the post here, and literally trying "wierd" things, I had an idea.
Essentially I used the *.csproj.user file, declared a UserConfig property, added a new Constant (for code checks), and did an ItemGroup with the condition of the UserConfig. All this fell under the DEBUG flag.
The only issue is that the file does not show up in the solution explorer, but in c++ they didn't either.
My *.csproj.user file
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<UserConfig>Tom</UserConfig>
<DefineConstants>DEBUG;TRACE;TOM</DefineConstants>
</PropertyGroup>
<ItemGroup Condition=" '$(UserConfig)' == 'Tom'">
<Compile Include="Tom.cs" />
</ItemGroup>
</Project>
Resulting Code
#if (TOM)
Tom t = new Tom();
#endif
Upvotes: 1
Reputation: 10827
I am currently trying this.
<ItemGroup Condition=" '$(Configuration)' == 'Tom'">
<Compile Include="Tom.cs" />
</ItemGroup>
Upvotes: 0
Reputation:
MSBuild has Conditional Constructs. All you have to do is modify the Solution file to include what you want. The end result would look very similar to your example code.
<When Condition=" '$(Configuration)'=='TOM' ">
<ItemGroup>
<Compile Include="tomCode\*.cs" />
</ItemGroup>
</When>
Upvotes: 1