use*_*436 4 c# pre-build-event
我在visual studio 2010 c#中有解决方案.在预构建事件中,我执行更改此解决方案中的文件的命令.更新的文件不是在当前版本中构建的.我怎么能这样做,带有更改的文件将在当前版本中构建?
谢谢.
好吧,似乎我发现了你的问题.
我已经设置了一个简单的控制台应用程序和此事件:
<PreBuildEvent>copy "D:\Program.cs" "D:\Projects\PreBuildFileModification\FileModification\Program.cs" /Y</PreBuildEvent>
Run Code Online (Sandbox Code Playgroud)
唉,这不起作用!(复制发生并更新磁盘上的文件,但Visual Studio不检测这些更改并加载缓存文件).
解决方案是添加:
<UseHostCompilerIfAvailable>false</UseHostCompilerIfAvailable>
Run Code Online (Sandbox Code Playgroud)
在您的配置中,例如:
<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>
Run Code Online (Sandbox Code Playgroud)
而现在这就像一个魅力.
| 归档时间: |
|
| 查看次数: |
1159 次 |
| 最近记录: |