Ne "en iyi uygulama Yerel" Kopyala ve proje başvuruları ile?
Büyük bir c# çözüm dosyası (~100 projeleri ve kat artırmak kurmaya çalışıyorum. "Copy Local" birçok durumda gereksiz bizim için, ama en iyi yöntemler hakkında merak ediyorum. bence
Bizim içinde .sln, bizim durumumuzda Meclisi C. bağlı olan uygulama Bir derleme B bağlı olarak, düzinelerce vardır "B" ve bir avuç "C". Bu yana tüm dahil .sln, proje başvuruları kullanıyoruz. Tüm derlemeleri şu anda(SolutionDir) $/hata Ayıklama (veya Serbest) oluşturmak.
Varsayılan olarak, Visual Studio bu proje başvuruları gibi markalar "Yerel Kopyasını her hangi sonuçları", "C" kopyalanan(SolutionDir) $hata Ayıklama sonra her/"B" oluşturur. Bu savurgan görünüyor. Eğer sadece "Yerel"? Kopya açarsanız ne ters gidebilir ki Büyük sistemler ile diğer insanlar ne yapsın?
TAKİP:
Tepkiler çok daha küçük bir yapı parçalandığını gösteriyor .sln dosyaları... yukarıdaki örnekte, foundation sınıf inşa ediyorum "C" ilk olarak, modüllerin toplu ardından "B", ve sonra birkaç uygulama, "". Bu model, ihtiyacım var olmayan proje başvuruları C B. sorunum Çalıştır oraya "Debug" veya "Serbest" alır pişmiş içine ipucu yol ve rüzgar artıyor benim Sürüm oluşturur "B" karşı hata ayıklama yapılar "C".
O sizin için bu bölme birden çok içine kurmak .dosyaları sln, bu sorunu nasıl başarıyorsun?
CEVAP
Bir önceki proje başvuruları ile büyük bir çözüm ile çalıştım ve performans ile ilgili bir sorun çarptı. Çözüm üç kat oldu:
Her zaman Kopya Yerel özelliği false ve özel msbuild bir adım ile bu zorlamak için ayarlayın
Aynı dizine her proje için çıkış dizinini ayarlayın (tercihen(SolutionDir) bağıl$
Varsayılan cs çerçevesi referans kümesi proje şu anda inşa ediliyor çıktı dizinine kopyalanacak hesaplamak ile birlikte olsun hedefler. Bunun altında geçişli kapanışı 'Referanslar' ilişkisi olabilir bu . hesaplama gerektirdiğinden ^strong>ÇOKpahalı. Bu benim için geçici çözüm, ortak hedefler bir dosya (örn.
GetCopyToOutputDirectoryItems
hedef yeniden tanımlamak olduCommon.targets
)Microsoft.CSharp.targets
ithalat sonrası her projede ithal. Her proje dosyasında aşağıdaki gibi elde edilir:<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> ... snip ... </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="[relative path to Common.targets]" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>
Bu birkaç dakika için birkaç saat (bellek kısıtlamaları nedeniyle çoğunlukla), belirli bir zamanda inşa zamanımız azaldı.
GetCopyToOutputDirectoryItems
Common.targets
içine mogoton 2,438-2,450 satırları kopyalama ve 2,474-2,524 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets
tarafından oluşturulabilir yeniden tanımlandı.
Tutarlılık için elde edilen hedef tanımı gelir:
<!-- This is a modified version of the Microsoft.Common.targets
version of this target it does not include transitively
referenced projects. Since this leads to enormous memory
consumption and is not needed since we use the single
output directory strategy.
============================================================
GetCopyToOutputDirectoryItems
Get all project items that may need to be transferred to the
output directory.
============================================================ -->
<Target
Name="GetCopyToOutputDirectoryItems"
Outputs="@(AllItemsFullPathWithTargetPath)"
DependsOnTargets="AssignTargetPaths;_SplitProjectReferencesByFileExistence">
<!-- Get items from this project last so that they will be copied last. -->
<CreateItem
Include="@(ContentWithTargetPath->'%(FullPath)')"
Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)'=='Always' or '%(ContentWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"
>
<Output TaskParameter="Include" ItemName="AllItemsFullPathWithTargetPath"/>
<Output TaskParameter="Include" ItemName="_SourceItemsToCopyToOutputDirectoryAlways"
Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
<Output TaskParameter="Include" ItemName="_SourceItemsToCopyToOutputDirectory"
Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
</CreateItem>
<CreateItem
Include="@(_EmbeddedResourceWithTargetPath->'%(FullPath)')"
Condition="'%(_EmbeddedResourceWithTargetPath.CopyToOutputDirectory)'=='Always' or '%(_EmbeddedResourceWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"
>
<Output TaskParameter="Include" ItemName="AllItemsFullPathWithTargetPath"/>
<Output TaskParameter="Include" ItemName="_SourceItemsToCopyToOutputDirectoryAlways"
Condition="'%(_EmbeddedResourceWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
<Output TaskParameter="Include" ItemName="_SourceItemsToCopyToOutputDirectory"
Condition="'%(_EmbeddedResourceWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
</CreateItem>
<CreateItem
Include="@(Compile->'%(FullPath)')"
Condition="'%(Compile.CopyToOutputDirectory)'=='Always' or '%(Compile.CopyToOutputDirectory)'=='PreserveNewest'">
<Output TaskParameter="Include" ItemName="_CompileItemsToCopy"/>
</CreateItem>
<AssignTargetPath Files="@(_CompileItemsToCopy)" RootFolder="$(MSBuildProjectDirectory)">
<Output TaskParameter="AssignedFiles" ItemName="_CompileItemsToCopyWithTargetPath" />
</AssignTargetPath>
<CreateItem Include="@(_CompileItemsToCopyWithTargetPath)">
<Output TaskParameter="Include" ItemName="AllItemsFullPathWithTargetPath"/>
<Output TaskParameter="Include" ItemName="_SourceItemsToCopyToOutputDirectoryAlways"
Condition="'%(_CompileItemsToCopyWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
<Output TaskParameter="Include" ItemName="_SourceItemsToCopyToOutputDirectory"
Condition="'%(_CompileItemsToCopyWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
</CreateItem>
<CreateItem
Include="@(_NoneWithTargetPath->'%(FullPath)')"
Condition="'%(_NoneWithTargetPath.CopyToOutputDirectory)'=='Always' or '%(_NoneWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"
>
<Output TaskParameter="Include" ItemName="AllItemsFullPathWithTargetPath"/>
<Output TaskParameter="Include" ItemName="_SourceItemsToCopyToOutputDirectoryAlways"
Condition="'%(_NoneWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
<Output TaskParameter="Include" ItemName="_SourceItemsToCopyToOutputDirectory"
Condition="'%(_NoneWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
</CreateItem>
</Target>
Bu geçici çözüm ile çalışılabilir ^ kadar bulunmuştur . 120 projeleri bir çözümde, bu projelerin inşa sipariş hala çözüm bölerek bunu elle yapmak yerine VS ile belirlenebilir ana yararı vardır.
Böyle büyük mükafat aniden donanım pro...
Java Hatası: "güvenlik ayarları ç...
Çeşitli "eylem Oluştur&; Visual S...
İletişim atma "pencereyi simge bo...
YAY kullanmak için bir proje dönüştürü...