2

私のServiceDefinition.csdefファイルには、次のものがあります。

 <Startup>
      <Task commandLine="powershell -ExecutionPolicy Unrestricted -command &quot;Install-WindowsFeature Net-Framework-Core&quot;" taskType="simple" executionContext="elevated"/>
 </Startup>

しかし、それを紺碧に公開しようとすると、次のようになります。

Cannot find file named 'approot\bin\powershell' for startup task powershell -ExecutionPolicy Unrestricted -command "Install-WindowsFeature Net-Framework-Core"  of role WebRole.

PowerShellを実行しようとしているので、.net 3.5はOSファミリ「3」(Windows 2012)をインストールできます。そのコマンドは、私のインスタンスにリモート接続されている間、cmd行から正常に実行されます。

PowerShellを実行するための正しい構文は何ですか?

4

1 に答える 1

1

MichaelVolodarskyの助けを借りて動作させました。

  1. 「スタートアップ」フォルダに「install35.cmd」というファイルを作成します。

powershell -ExecutionPolicy Unrestricted -command "Install-WindowsFeature Net-Framework-Core" exit 0

  1. 名前を付けて保存/詳細/コードページをWindows1252に設定
  2. ソリューションエクスプローラーで、右クリックしてビルドタイプ=コンテンツを設定し、常にコピーします
  3. スタートアップタスクで、以下を追加します。

于 2013-03-12T00:25:26.900 に答える