Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vsix/ItemTemplates/BlankPage/BlankPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using namespace winrt;
using namespace Windows::UI::Xaml;

namespace winrt::$rootnamespace$::implementation
namespace winrt::$cpprootnamespace$::implementation
{
$safeitemname$::$safeitemname$()
{
Expand Down
4 changes: 2 additions & 2 deletions vsix/ItemTemplates/BlankPage/BlankPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "$safeitemname$.g.h"

namespace winrt::$rootnamespace$::implementation
namespace winrt::$cpprootnamespace$::implementation
{
struct $safeitemname$ : $safeitemname$T<$safeitemname$>
{
Expand All @@ -15,7 +15,7 @@ namespace winrt::$rootnamespace$::implementation
};
}

namespace winrt::$rootnamespace$::factory_implementation
namespace winrt::$cpprootnamespace$::factory_implementation
{
struct $safeitemname$ : $safeitemname$T<$safeitemname$, implementation::$safeitemname$>
{
Expand Down
4 changes: 2 additions & 2 deletions vsix/ItemTemplates/BlankPage/cppwinrt_BlankPage.vstemplate
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<ProjectItem SubType="Code" TargetFileName="$fileinputname$.xaml\$fileinputname$.idl" ReplaceParameters="true">BlankPage.idl</ProjectItem>
</TemplateContent>
<WizardExtension>
<Assembly>NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
<FullClassName>NuGet.VisualStudio.TemplateWizard</FullClassName>
<Assembly>Microsoft.Windows.CppWinRT, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
<FullClassName>Microsoft.Windows.CppWinRT.WizardExtension</FullClassName>
</WizardExtension>
<WizardData>
<packages repository="extension" repositoryId="Microsoft.Windows.CppWinRT">
Expand Down
2 changes: 1 addition & 1 deletion vsix/ItemTemplates/BlankUserControl/BlankUserControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using namespace winrt;
using namespace Windows::UI::Xaml;

namespace winrt::$rootnamespace$::implementation
namespace winrt::$cpprootnamespace$::implementation
{
$safeitemname$::$safeitemname$()
{
Expand Down
4 changes: 2 additions & 2 deletions vsix/ItemTemplates/BlankUserControl/BlankUserControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "winrt/Windows.UI.Xaml.Controls.Primitives.h"
#include "$safeitemname$.g.h"

namespace winrt::$rootnamespace$::implementation
namespace winrt::$cpprootnamespace$::implementation
{
struct $safeitemname$ : $safeitemname$T<$safeitemname$>
{
Expand All @@ -19,7 +19,7 @@ namespace winrt::$rootnamespace$::implementation
};
}

namespace winrt::$rootnamespace$::factory_implementation
namespace winrt::$cpprootnamespace$::factory_implementation
{
struct $safeitemname$ : $safeitemname$T<$safeitemname$, implementation::$safeitemname$>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<ProjectItem SubType="Code" TargetFileName="$fileinputname$.xaml\$fileinputname$.idl" ReplaceParameters="true">BlankUserControl.idl</ProjectItem>
</TemplateContent>
<WizardExtension>
<Assembly>NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
<FullClassName>NuGet.VisualStudio.TemplateWizard</FullClassName>
<Assembly>Microsoft.Windows.CppWinRT, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
<FullClassName>Microsoft.Windows.CppWinRT.WizardExtension</FullClassName>
</WizardExtension>
<WizardData>
<packages repository="extension" repositoryId="Microsoft.Windows.CppWinRT">
Expand Down
2 changes: 1 addition & 1 deletion vsix/ItemTemplates/ViewModel/ViewModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "$safeitemname$.g.cpp"
#endif

namespace winrt::$rootnamespace$::implementation
namespace winrt::$cpprootnamespace$::implementation
{
int32_t $safeitemname$::MyProperty()
{
Expand Down
4 changes: 2 additions & 2 deletions vsix/ItemTemplates/ViewModel/ViewModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "$safeitemname$.g.h"

namespace winrt::$rootnamespace$::implementation
namespace winrt::$cpprootnamespace$::implementation
{
struct $safeitemname$ : $safeitemname$T<$safeitemname$>
{
Expand All @@ -13,7 +13,7 @@ namespace winrt::$rootnamespace$::implementation
};
}

namespace winrt::$rootnamespace$::factory_implementation
namespace winrt::$cpprootnamespace$::factory_implementation
{
struct $safeitemname$ : $safeitemname$T<$safeitemname$, implementation::$safeitemname$>
{
Expand Down
4 changes: 2 additions & 2 deletions vsix/ItemTemplates/ViewModel/cppwinrt_ViewModel.vstemplate
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<ProjectItem SubType="Code" TargetFileName="$fileinputname$.idl\$fileinputname$.h" ReplaceParameters="true">ViewModel.h</ProjectItem>
</TemplateContent>
<WizardExtension>
<Assembly>NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
<FullClassName>NuGet.VisualStudio.TemplateWizard</FullClassName>
<Assembly>Microsoft.Windows.CppWinRT, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
<FullClassName>Microsoft.Windows.CppWinRT.WizardExtension</FullClassName>
</WizardExtension>
<WizardData>
<packages repository="extension" repositoryId="Microsoft.Windows.CppWinRT">
Expand Down
70 changes: 70 additions & 0 deletions vsix/WizardExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using EnvDTE;
using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.TemplateWizard;
using NuGet.VisualStudio;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;

namespace Microsoft.Windows.CppWinRT
{
internal sealed class WizardExtension : IWizard
{
[Import]
internal IVsTemplateWizard Wizard { get; set; }

private void Initialize(object automationObject)
{
ThreadHelper.ThrowIfNotOnUIThread();
using (var serviceProvider = new ServiceProvider((IServiceProvider)automationObject))
{
var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));
Assumes.Present(componentModel);
using (var container = new CompositionContainer(componentModel.DefaultExportProvider))
{
container.ComposeParts(this);
}
}
}

void IWizard.BeforeOpeningFile(ProjectItem projectItem)
{
Wizard.BeforeOpeningFile(projectItem);
}

void IWizard.ProjectFinishedGenerating(Project project)
{
Wizard.ProjectFinishedGenerating(project);
}

void IWizard.ProjectItemFinishedGenerating(ProjectItem projectItem)
{
Wizard.ProjectItemFinishedGenerating(projectItem);
}

void IWizard.RunFinished()
{
Wizard.RunFinished();
}

void IWizard.RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
{
ThreadHelper.ThrowIfNotOnUIThread();
Initialize(automationObject);

if (replacementsDictionary.TryGetValue("$rootnamespace$", out var rootNamespace))
{
replacementsDictionary.Add("$cpprootnamespace$", rootNamespace.Replace(".", "::"));
}

Wizard.RunStarted(automationObject, replacementsDictionary, runKind, customParams);
}

bool IWizard.ShouldAddProjectItem(string filePath)
{
return Wizard.ShouldAddProjectItem(filePath);
}
}
}
4 changes: 0 additions & 4 deletions vsix/packages.config

This file was deleted.

65 changes: 33 additions & 32 deletions vsix/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="Microsoft.Windows.CppWinRT" Version="|%CurrentProject%;GetCppWinRTVersion|" Language="en-US" Publisher="Microsoft" />
<PackageId>Microsoft.Windows.CppWinRT</PackageId>
<DisplayName>C++/WinRT</DisplayName>
<Description xml:space="preserve">Tools for authoring and consuming Windows Runtime classes in standard C++.</Description>
<MoreInfo>https://go.microsoft.com/fwlink/?linkid=869449</MoreInfo>
<License>LICENSE</License>
<GettingStartedGuide>https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt</GettingStartedGuide>
<ReleaseNotes>https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/faq</ReleaseNotes>
<Icon>cppwinrt.ico</Icon>
<PreviewImage>cppwinrt.png</PreviewImage>
<Tags>WinRT, C++, cppwinrt, native</Tags>
</Metadata>
<Installation AllUsers="true">
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0,17.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[15.0,17.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[15.0,17.0)" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
</Dependencies>
<Assets>
<Asset Type="NativeVisualizer" Path="cppwinrt.natvis" />
<Asset Type="DebuggerEngineExtension" Path="CppWinrtVisualizer.vsdconfig" />
<Asset Type="Microsoft.VisualStudio.ItemTemplate" Path="ItemTemplates" />
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" Path="ProjectTemplates" />
<Asset Type="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetCppWinRTVersion|.nupkg" Source="File" Path="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetCppWinRTVersion|.nupkg" VsixSubPath="Packages" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,)" DisplayName="Visual Studio core editor" />
<Prerequisite Id="Microsoft.VisualStudio.ComponentGroup.UWP.VC" Version="[15.0,)" DisplayName="C++ Universal Windows Platform tools" />
</Prerequisites>
<Metadata>
<Identity Id="Microsoft.Windows.CppWinRT" Version="|%CurrentProject%;GetCppWinRTVersion|" Language="en-US" Publisher="Microsoft" />
<PackageId>Microsoft.Windows.CppWinRT</PackageId>
<DisplayName>C++/WinRT</DisplayName>
<Description xml:space="preserve">Tools for authoring and consuming Windows Runtime classes in standard C++.</Description>
<MoreInfo>https://go.microsoft.com/fwlink/?linkid=869449</MoreInfo>
<License>LICENSE</License>
<GettingStartedGuide>https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt</GettingStartedGuide>
<ReleaseNotes>https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/faq</ReleaseNotes>
<Icon>cppwinrt.ico</Icon>
<PreviewImage>cppwinrt.png</PreviewImage>
<Tags>WinRT, C++, cppwinrt, native</Tags>
</Metadata>
<Installation AllUsers="true">
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0,17.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[15.0,17.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[15.0,17.0)" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
</Dependencies>
<Assets>
<Asset Type="NativeVisualizer" Path="cppwinrt.natvis" />
<Asset Type="DebuggerEngineExtension" Path="CppWinrtVisualizer.vsdconfig" />
<Asset Type="Microsoft.VisualStudio.ItemTemplate" Path="ItemTemplates" />
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" Path="ProjectTemplates" />
<Asset Type="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetCppWinRTVersion|.nupkg" Source="File" Path="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetCppWinRTVersion|.nupkg" VsixSubPath="Packages" />
<Asset Type="Microsoft.VisualStudio.Assembly" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%|" AssemblyName="|%CurrentProject%;AssemblyName|" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,)" DisplayName="Visual Studio core editor" />
<Prerequisite Id="Microsoft.VisualStudio.ComponentGroup.UWP.VC" Version="[15.0,)" DisplayName="C++ Universal Windows Platform tools" />
</Prerequisites>
</PackageManifest>
Loading