두 개의 Visual Studio 데이터베이스 프로젝트가 있습니다. 내가 프로젝트 BI를 빌드 할 때 프로젝트 B는 A. 에 대한 참조를 가지고있는 동안MsBuild 프로젝트 사이의 PropertyGroup 전달
Project A
Project B
- References: Project A
프로젝트 A는 indipendent 데이터베이스 프로젝트의 MSBuild에서 다음 예상 출력이 있습니다
------ Build started: Project: Project A, Configuration: Debug Any CPU
--------- Build started: Project: Project B, Configuration: Debug Any CPU ------
========== Build: 2 succeeded or up-to-date, 0 failed, 0 skipped ==========
프로젝트 B I 에서을 다음과 같은 방법으로 정의 된 속성이 있습니다 :
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<MyProperty>MyValue</MyProperty>
</PropertyGroup>
이제 두 프로젝트에서 나는 간단한 작업을 만들었습니다. 프로젝트 A, B :
<Target Name="Print" BeforeTargets="Build">
<Message Text="MyProperty is: $(MyProperty)" Importance="high" />
</Target>
불행하게도 내가 MSBUILD에이 동작을 얻을 : 내가 프로젝트를 빌드하고이 변수의 값을 인쇄하기 전에 실행에
------ Build started: Project: Project A, Configuration: Debug Any CPU
MyProperty is:
--------- Build started: Project: Project B, Configuration: Debug Any CPU ------
MyProperty is: MyValue
========== Build: 2 succeeded or up-to-date, 0 failed, 0 skipped ==========
나는 참고로이 이 구성으로 프로젝트 B의 프로젝트 A :
<ItemGroup>
<ProjectReference IncludeProjectA.dbproj">
<Name>ProjectA</Name>
<Project>{f6546bef-cea7-4e7f-b6f1-cce1c06c7b1a}</Project>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
프로젝트 B에서 프로젝트 A의 MyProperty 값을 삽입 할 수있는 방법이 있습니까?
정확히, 이것이 내가 한 일입니다. 여러 프로젝트를 빌드하는 사용자 지정 대상을 만들고 각각에 태그를 사용하여 필요한 변수를 전달합니다. –
Raffaeu
여러 프로젝트에서 재사용 한 프로젝트 파일을 공유 할 수 있습니까? – gap
정말 특별한 것은 없지만 표준 MSBuild 프로젝트 파일 루트 요소 인''만 있으면됩니다. 그런 다음 PropertyGroup과 같이 원하는 속성을 입력하십시오. –
Snixtor