以下是我的MSBuild XML。在BeforeBuild中生成的文件不包含在DLL中。我期待包含该文件。我注意到在BuildBuild中调用了CoreBuild。如何重新进行重建,包括生成的文件。
由于
克里斯
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
...
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
...
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
...
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include=".\Resources\Assembly\*.dll" Condition="Exists('.\Resources\Assembly')" />
...
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include=".\**\*.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<UsingTask TaskName="EdmTasks.ViewRefreshTask" AssemblyFile=".\Resources\Assembly\EdmTasks.dll" />
<Target Name="BeforeBuild">
<MsBuild Projects="ForwardPAS.csproj" Targets="CoreBuild" />
<ViewRefreshTask Assembly="$(TargetPath)" Lang="cs" DbContext="FranklinIndexedAnnuityDb" />
</Target>
</Project>
答案 0 :(得分:0)
<Target Name="BeforeBuild">
<MsBuild Projects="MyProject.csproj" Targets="CoreBuild" />
<ViewRefreshTask Assembly="$(TargetPath)" Lang="cs" DbContext="MyDatabaseContext" />
<MsBuild Projects="MyProject.csproj" Targets="CoreBuild" Properties="Rerun=true" />
</Target>
它进行了重建,项目DLL生成了我生成的视图。
答案 1 :(得分:0)
直接在csharp目标行之后
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
添加此
<PropertyGroup>
<UseHostCompilerIfAvailable>False</UseHostCompilerIfAvailable>
</PropertyGroup>
VS将再次获取源代码进行编译,而不是在构建过程开始时使用缓存版本。