1

既存のWCFサービスライブラリの機能をコピーして、新しいWCFサービスライブラリのテンプレートとして使用しようとしていました。必要なすべてのコードをカットアンドペーストするつもりで、デフォルトのサービススタブを作成したくなかったので、組み込みの「WCFサービスライブラリ」プロジェクトテンプレートを使用して開始しませんでした。「空のプロジェクト」テンプレートを使用して、ソリューションに新しい空のプロジェクトを追加しました。

次に、サービスのインターフェイスとクラスを保持するために、プロジェクトに2つの新しい空白の.csコードファイルを作成し、元のWCFサービスライブラリプロジェクトからインターフェイスとクラスのコードをコピーして貼り付け、必要な変更を加えました。

ただし、新しいプロジェクトは正常にコンパイルされます...

1)プロジェクトのプロパティに移動すると、元のWCFサービスライブラリのように[WCFオプション]セクションが表示されません。

2)元のWCFサービスライブラリプロジェクトでは、それを右クリックして[デバッグ]-> [新しいインスタンスの開始]を選択すると、WCFサービスホストを使用して自動的に開始されます。新しいプロジェクトでは、それを試してみると、「出力タイプがクラスライブラリのプロジェクトを直接開始することはできません」と表示されます。

「WCFサービスライブラリ」プロジェクトテンプレートを最初からやり直して使用するのではなく、Visual Studio(2012 Professionalを使用)でこのプロジェクトを真のWCFクラスライブラリとして表示するにはどうすればよいですか?

4

1 に答える 1

3

You are missing the ProjectExtensions section from your project file

This is from one of my VS2010 projects.

  <ProjectExtensions>
      <VisualStudio>
      <FlavorProperties GUID="{3D9AD99F-2412-4246-B90B-4EAA41C64699}">
        <WcfProjectProperties>
          <AutoStart>True</AutoStart>
        </WcfProjectProperties>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>

If I remove it, the WCF Options properties section goes away.

EDIT:

I did a comparison of an Empty project to a WCF Service Library, and found that you also need to add this to your project to get the WCF Options to appear in the project properties

<ProjectTypeGuids>{3D9AD99F-2412-4246-B90B-4EAA41C64699};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>

There is another entry in WCF (and not in the Empty project)

<StartArguments>/client:"WcfTestClient.exe"</StartArguments>

which I'm assuming is needed when you do the

Debug->Start New Instance

There is other stuff that you will need however, such as a reference to System.ServiceModel.

To be honest, I think you'd be better off using the proper WCF Service Library template and cutting out stuff you don't want, rather than trying to figure out what you do need.

于 2013-02-05T00:54:14.903 に答える