यहां मैंने इसे कैसे संभाला है।
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
namespace SynchBuild
{
public class RemoveAsterisk : Task
{
private string myVersion;
[Required]
public string Version
{
set{myVersion = value;}
}
[Output]
public string ReturnValue
{
get { return myVersion.Replace("*", ""); }
}
public override bool Execute()
{
return true;
}
}
}
ताकि SynchBuild.dll जो आप नीचे UsingTask में संदर्भित देखें में बनाया जाता है: सबसे पहले मुझे लगता है कि स्ट्रिंग प्रतिस्थापन लपेटता एक कस्टम कार्य बनाया। अब मैं सिर्फ MinimumRequiredVersion संपत्ति overwritting की कोशिश की है, लेकिन यह उठाया पाने के लिए नहीं लगता था, इसलिए मैं सिर्फ अपनी csproj फ़ाइल के अंत में निम्नलिखित लाइनों को जोड़कर GenerateApplicationManifest लक्ष्य को ओवरराइट कर:
<UsingTask AssemblyFile="$(MSBuildExtensionsPath)\WegmansBuildTasks\SynchBuild.dll" TaskName="SynchBuild.RemoveAsterisk" />
<Target Name="GenerateDeploymentManifest" DependsOnTargets="GenerateApplicationManifest" Inputs="
 $(MSBuildAllProjects);
 @(ApplicationManifest)
 " Outputs="@(DeployManifest)">
<RemoveAsterisk Version="$(ApplicationVersion)$(ApplicationRevision)">
<Output TaskParameter="ReturnValue" PropertyName="MinimumRequiredVersion" />
</RemoveAsterisk>
<GenerateDeploymentManifest MinimumRequiredVersion="$(MinimumRequiredVersion)" AssemblyName="$(_DeploymentDeployManifestIdentity)" AssemblyVersion="$(_DeploymentManifestVersion)" CreateDesktopShortcut="$(CreateDesktopShortcut)" DeploymentUrl="$(_DeploymentFormattedDeploymentUrl)" Description="$(Description)" DisallowUrlActivation="$(DisallowUrlActivation)" EntryPoint="@(_DeploymentResolvedDeploymentManifestEntryPoint)" ErrorReportUrl="$(_DeploymentFormattedErrorReportUrl)" Install="$(Install)" MapFileExtensions="$(MapFileExtensions)" MaxTargetPath="$(MaxTargetPath)" OutputManifest="@(DeployManifest)" Platform="$(PlatformTarget)" Product="$(ProductName)" Publisher="$(PublisherName)" SuiteName="$(SuiteName)" SupportUrl="$(_DeploymentFormattedSupportUrl)" TargetCulture="$(TargetCulture)" TargetFrameworkVersion="$(TargetFrameworkVersion)" TrustUrlParameters="$(TrustUrlParameters)" UpdateEnabled="$(UpdateEnabled)" UpdateInterval="$(_DeploymentBuiltUpdateInterval)" UpdateMode="$(UpdateMode)" UpdateUnit="$(_DeploymentBuiltUpdateIntervalUnits)" Condition="'$(GenerateClickOnceManifests)'=='true'">
<Output TaskParameter="OutputManifest" ItemName="FileWrites" />
</GenerateDeploymentManifest>
</Target>
अंतिम परिणाम क्या हम ऐप संस्करण और संशोधन लेते हैं, उन्हें गठबंधन करते हैं, तारांकन हटाते हैं, फिर न्यूनतम आवश्यक संस्करण सेट करते हैं। मेरे पास मेरे प्रकाशित गुण सेट में ऑटो वृद्धि एप संस्करण है, इसलिए यह बढ़ता जा रहा है कि मैं कितनी वृद्धि कर रहा हूं, फिर मैं हमेशा न्यूनतम मिलान करने के लिए न्यूनतम रिक्वेर्डवर्जन सेट कर रहा हूं। मैं टीम बिल्ड का उपयोग नहीं करता हूं, यह सिर्फ डिज़ाइन किया गया है ताकि विज़ुअल स्टूडियो का उपयोग करने वाला डेवलपर सभी क्लिकऑन परिनियोजन की आवश्यकता हो सकती है। उम्मीद है की यह मदद करेगा।
स्रोत
2009-01-30 13:15:00
मेरे पास इसका एक साफ समाधान है। कृपया मेरा जवाब देखें [यहां] (http://stackoverflow.com/a/31665818/450913)। – orad