Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 基于配置从内置VS2008中排除整个文件_.net_Visual Studio 2008_Msbuild_Build Process - Fatal编程技术网

.net 基于配置从内置VS2008中排除整个文件

.net 基于配置从内置VS2008中排除整个文件,.net,visual-studio-2008,msbuild,build-process,.net,Visual Studio 2008,Msbuild,Build Process,我的项目中有三种不同的配置,这三种配置都不需要将所有文件构建到应用程序中。事实上,我更愿意从构建中排除这些文件,这将使我的应用程序更加轻量级 我要找的是#if MYCONFIG或#if DEBUG语句,但不针对文件。我已经读到,这可以通过手动编辑csproj文件来实现,但我再也找不到了……还有其他方法吗?有两种不同的方法: 在csproj文件中,您将看到如下部分: <ItemGroup> <Compile Include="Helper.cs" /> &l

我的项目中有三种不同的配置,这三种配置都不需要将所有文件构建到应用程序中。事实上,我更愿意从构建中排除这些文件,这将使我的应用程序更加轻量级


我要找的是
#if MYCONFIG
#if DEBUG
语句,但不针对文件。我已经读到,这可以通过手动编辑csproj文件来实现,但我再也找不到了……还有其他方法吗?

有两种不同的方法: 在csproj文件中,您将看到如下部分:

<ItemGroup>
    <Compile Include="Helper.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
在底部有

#endif
然后可以定义调试符号;在项目文件上单击鼠标右键,选择“属性”,转到“生成”选项卡,然后在“条件编译符号”文本框中输入调试符号


我可能会坚持第一种方法。

对于C项目的旧VS2008项目文件,这也可能吗?
#if MYDEBUGSYMBOL
#endif