ビジュアルスタジオテンプレートウィザードのGUIが表示されるのに問題があります。 http://msdn.microsoft.com/en-us/library/ms185301.aspxVS2012テンプレートウィザード - GUIが表示されない
ここに私がやったことだ:私はこれらの手順に従っ
1)以下のファイルをC#クラスライブラリ(.dll)を生成:
UserInputForm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace myprojectvstemplate
{
public partial class UserInputForm : Form
{
private string customMessage;
public UserInputForm()
{
InitializeComponent();
MessageBox.Show("here, calling ui");
}
public string get_CustomMessage()
{
return customMessage;
}
private void button1_Click(object sender, EventArgs e)
{
customMessage = textBox1.Text;
this.Dispose();
}
}
}
2 )編集ボックスとコード付きのコンボボックス付きのユーザー入力フォームを追加しました。UserInputForm.cs
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TemplateWizard;
using System.Windows.Forms;
using EnvDTE;
namespace myprojectvstemplate
{
public class IWizardImplementation : IWizard
{
private UserInputForm inputForm;
private string customMessage;
// This method is called before opening any item that
// has the OpenInEditor attribute.
public void BeforeOpeningFile(ProjectItem projectItem)
{
}
public void ProjectFinishedGenerating(Project project)
{
}
// This method is only called for item templates,
// not for project templates.
public void ProjectItemFinishedGenerating(ProjectItem
projectItem)
{
}
// This method is called after the project is created.
public void RunFinished()
{
}
public void RunStarted(object automationObject,
Dictionary<string, string> replacementsDictionary,
WizardRunKind runKind, object[] customParams)
{
try
{
// Display a form to the user. The form collects
// input for the custom message.
inputForm = new UserInputForm();
inputForm.ShowDialog();
customMessage = inputForm.get_CustomMessage();
// Add custom parameters.
replacementsDictionary.Add("$custommessage$",
customMessage);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
// This method is only called for item templates,
// not for project templates.
public bool ShouldAddProjectItem(string filePath)
{
return true;
}
}
}
3)ます。gacutilでそれを登録し、パブリック/プライベート強い鍵を生成し、プロパティページ
4)DLL をリリース、生成された)に「署名」タブからアセンブリを登録/私はmydllname。 DLL、ただ一つのファイルでC++のコンソールプロジェクトテンプレートを作成したエラーなし ):
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
cout << "Hi hello world:" << "$custommessage$";
return 0;
}
7)「に自動的に対にインポートする」にチェックボックスでテンプレートプロジェクト(ない項目)としてエクスポート。私は、UIがまったく表示されていない新しいテンプレートプロジェクトを作成しようとすると、残念ながら
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
<TemplateData>
<Name>myproject_project</Name>
<Description><No description available></Description>
<ProjectType>VC</ProjectType>
<ProjectSubType>
</ProjectSubType>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<DefaultName>myproject_project</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<Icon>__TemplateIcon.ico</Icon>
</TemplateData>
<TemplateContent>
<Project TargetFileName="myproject_project.vcxproj" File="myproject_project.vcxproj" ReplaceParameters="true">
<ProjectItem ReplaceParameters="false" TargetFileName="$projectname$.vcxproj.filters">myproject_project.vcxproj.filters</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="myproject_project.cpp">myproject_project.cpp</ProjectItem>
<ProjectItem ReplaceParameters="false" TargetFileName="ReadMe.txt">ReadMe.txt</ProjectItem>
</Project>
</TemplateContent>
<WizardExtension>
<Assembly>myprojectvstemplate, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=a0a3d031ed112d61</Assembly>
<FullClassName>myprojectvstemplate.IWizardImplementation</FullClassName>
</WizardExtension>
</VSTemplate>
:ファスナー内部でこのような.vstemplateファイルをファイルに変更。プロジェクトは開かれたばかりで、$ custommessage $パラメータの代用はありません。
ウィザードのGUIを表示できないのはなぜですか?
さらに、アセンブリがロードされていない理由をデバッグする方法はありますか?
私は多くのトリッキーと機械をやらなければならなかったが、ありがとうParesh、ちょうど私にヒントを与えたが、私はついにそれを働かせた。 –
お手伝いします:) – Paresh138