我正在尝试使用 MSBuild 编译我的 ASP.NET MVC3 应用程序。由于 DLL 不需要Main
方法并且我已指定目标是库,为什么编译器会抛出以下异常:
CSC : error CS5001: Program 'c:\MvcApplication1\web\bin\MvcApplication1.dll' does not contain a static 'Main' method suitable for an entry point[C:\MvcApplication1\web\MvcApplication1.csproj]
这是 .csproj 文件:
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<AssemblyName>MvcApplication1</AssemblyName>
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="*.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="..\lib\*.dll" />
</ItemGroup>
<Target Name="Build">
<MakeDir Directories="$(OutputPath)" Condition="!Exists('$(OutputPath)')" />
<Csc References="@(Reference)" Sources="@(Compile)" OutputAssembly="$(OutputPath)$(AssemblyName).dll" />
<Copy SourceFiles="@(Reference)" DestinationFolder="$(OutputPath)" />
</Target>
</Project>