我在visual studio 2010 c#中有解决方案。在预构建事件中,我执行更改此解决方案中的文件的命令。更新的文件未在当前版本中构建。我怎样才能做到这一点,文件,随着更改,将在当前版本中构建???
谢谢。
我在visual studio 2010 c#中有解决方案。在预构建事件中,我执行更改此解决方案中的文件的命令。更新的文件未在当前版本中构建。我怎样才能做到这一点,文件,随着更改,将在当前版本中构建???
谢谢。
好的,看来我发现了你的问题。
我已经设置了一个简单的控制台应用程序和这个事件:
<PreBuildEvent>copy "D:\Program.cs" "D:\Projects\PreBuildFileModification\FileModification\Program.cs" /Y</PreBuildEvent>
唉,这不起作用!(复制发生并更新磁盘上的文件,但 Visual Studio 未检测到这些更改并加载缓存文件)。
解决方案是添加:
<UseHostCompilerIfAvailable>false</UseHostCompilerIfAvailable>
在您的配置中,例如:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseHostCompilerIfAvailable>false</UseHostCompilerIfAvailable>
</PropertyGroup>
现在这就像一个魅力。