आपके पास \ Build_Archive की तरह तैनाती के लिए एक अलग फ़ोल्डर हो सकता है जहां आउटपुट की प्रतिलिपि बनाई गई है - और अपनी असेंबली की प्रतिलिपि बनाने के लिए बिल्ड स्क्रिप्ट में कुछ लाइनें जोड़ें, लेकिन उन फ़ोल्डर्स को उपग्रह-असेंबली नहीं - इस तरह, Build_Archive हमेशा आपके पास तैनाती के लिए आवश्यक फाइलें हैं।
निर्माण # लेबल फ़ोल्डर में और वर्तमान फ़ोल्डर में मेरे वर्तमान स्क्रिप्ट प्रतियां यानी - तो वर्तमान हमेशा नवीनतम है, और हम पहले का एक इतिहास को बनाए रखने बनाता है - जैसे:
C:\Build_Archive\AppName\Current
C:\Build_Archive\AppName\1.0.0.1
C:\Build_Archive\AppName\1.0.0.2
तो कुछ इस तरह अपने निर्माण स्क्रिप्ट के अंत में (अपना सामान के लिए <values>
की जगह हमारी लिपि संस्करण संख्या, आदि तो यहाँ शामिल नहीं प्रबंधन करने के लिए एक बाहरी DLL उपयोग करता है।):
<!-- . . . -->
<DropLocation>\\<serverName>\Build_Archive\${BuildDefinition}</DropLocation>
<!-- . . . -->
<!-- Version numbers major and build are replaced by outside calls not shown -->
<PropertyGroup>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<VersionService>0</VersionService>
<VersionBuild>0</VersionBuild>
</PropertyGroup>
<Target Name="BuildNumberOverrideTarget">
<!-- Create a custom build number, matching the assembly version -->
<!-- . . . -->
<!-- … custom version code call – returns/sets VersionMajor and VersionBuild -->
<PropertyGroup>
<BuildNumber>$(BuildDefinitionName)_$(VersionMajor).$(VersionMinor).$(VersionService).$(VersionBuild)</BuildNumber>
</PropertyGroup>
<Message Text="Build number set to "$(BuildNumber)"" />
<Message Text="$(SolutionRoot)"/>
</Target>
<Target Name="AfterCompile">
<!-- Call Copy process after the build -->
<CallTarget Targets="CleanUp"/>
<CallTarget Targets="StageBuild"/>
<CallTarget Targets="CopyFiles"/>
</Target>
<!-- Target : Clean Current Folder for next build -->
<Target Name="CleanUp">
<Message Text="**** Entering::CleanUp ****"/>
<CreateItem Include="\\<server name>\Build_Archive\<appName>\Current\**\*.*">
<Output ItemName="PreviousFiles" TaskParameter="Include" />
</CreateItem>
<Delete Files="@(PreviousFiles)" ContinueOnError="true" />
</Target>
<!-- Target:StageBuild -->
<Target Name="StageBuild">
<ItemGroup>
<BldCurrent Include="\\<server name>\Build_Archive\<appName>\Current\"/>
</ItemGroup>
<Message Text="@(BldCurrent)"/>
<Message Text="$(SolutionRoot)"/>
<!— Here – replace next line with commands to copy only the files you want to deploy -->
<Exec Command="xcopy /y /r /e $(SolutionRoot)\..\bin\*.* @(BldCurrent)"/>
</Target>
<!-- Target : Copy files from Current to BuildNum folder -->
<Target Name="CopyFiles">
<Exec Command="xcopy /y /r /e $(DropLocation)\Current\Debug\*.* $(DropLocation)\$(BuildNumber)\Debug\"/>
<Exec Command="Del /Q $(DropLocation)\Current\Debug\*.config"/>
<Exec Command="Del /Q $(DropLocation)\Current\Debug\*.dll"/>
<Exec Command="Del /Q $(DropLocation)\Current\Debug\*.exe"/>
<Exec Command="Del /Q $(DropLocation)\Current\Debug\*.application"/>
<Exec Command="Del /Q $(DropLocation)\Current\Debug\*.pdb"/>
<Exec Command="Del /Q $(DropLocation)\Current\Debug\*.txt"/>
<Exec Command="Del /Q $(DropLocation)\Current\Debug\*.xml"/>
</Target>
आप सेट किया है [CopyLocal = false] (http://stackoverflow.com/ क्यू/2481426/147211) – KMoraz
मैं stil मैं असेंबली की प्रतिलिपि बनाना चाहता हूं, लेकिन सैटेलाइट असेंबली नहीं, जो कि नुजेट पैकेज में शामिल हैं। – DELUXEnized