2011-10-19 7 views
5

글쎄, 내가 설치 한 Visual Studio가 없기 때문에 설치하고 싶지 않다. 그래서 .csproj 파일과 모든 소스 파일을 컴파일하는 배치 파일을 만들었다.내 .csproj 파일에 DLL을 포함시키는 방법은 무엇입니까?

문제는 .dll 파일을 포함시키는 방법을 모른다는 것입니다. 여기 내 .csproj 파일 내 현재 코드는 다음과 같습니다

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <PropertyGroup> 
    <AssemblyName>Project</AssemblyName> 
    <OutputPath>Bin\</OutputPath> 
    </PropertyGroup> 

    <ItemGroup> 
     <!-- .cs files --> 
    <Compile Include="program.cs" /> 
    </ItemGroup> 

    <Target Name="Build"> 
    <MakeDir Directories="$(OutputPath)"  Condition="!Exists('$(OutputPath)')" /> 
    <Csc Sources="@(Compile)" OutputAssembly="$(OutputPath)$(AssemblyName).exe" /> 
    </Target> 
</Project> 

내가 포함/컴파일 프로세스에 DLL 파일을 참조하도록 변경해야합니까?

답변

8

당신은라는 기준과 같이 항목과 ItemGroup 필요합니다

<ItemGroup> 
    <Reference Include="Microsoft.Practices.Unity" /> 
    <Reference Include="MvcMiniProfiler"> 
     <HintPath>..\packages\MiniProfiler.1.6\lib\MvcMiniProfiler.dll</HintPath> 
    </Reference> 
    <Reference Include="System" /> 
    <Reference Include="System.configuration" /> 
    <Reference Include="System.Core" /> 
    <Reference Include="System.Data.Entity" /> 
    <Reference Include="System.Runtime.Serialization" /> 
    <Reference Include="System.Security" /> 
    <Reference Include="System.Web" /> 
    <Reference Include="System.Xml.Linq" /> 
    <Reference Include="System.Data.DataSetExtensions" /> 
    <Reference Include="Microsoft.CSharp" /> 
    <Reference Include="System.Data" /> 
    <Reference Include="System.Xml" /> 
    </ItemGroup> 

이 아닌 GAC'd을 참조하는 경우 (어느 HintPath에 둘 필요가 MVC 미니 프로파일을 볼 수 DLL을,이해야 빌드 파일 위치와 관련이 있어야 함) 또는 ReferencePath 속성에 MSBuild 경로를 전달해야합니다.