Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d1e8535fe4 | |||
| 483c80d810 | |||
| 622b5e979a | |||
| 8596be7e07 | |||
| 5c96d8c0c9 | |||
| 88e43bc7e8 | |||
| 416616e8f0 | |||
| 072e33e997 | |||
| 8002e34eca | |||
| d189fb69d6 | |||
| ebb510ea2e | |||
| 58d95afea5 | |||
| 5e50270b4b | |||
| e93bc8bfd2 | |||
| 4f89aeefe4 | |||
| b2429f3add | |||
| abeb5e25ab |
@@ -6,3 +6,5 @@ syntax: glob
|
||||
*.user
|
||||
*ReSharper*
|
||||
*/Setup/Setup/*
|
||||
UpgradeLog.htm
|
||||
RESW File Code Generator/Backup/
|
||||
@@ -1,18 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReswCodeGen.Tests", "ReswCodeGen.Tests\ReswCodeGen.Tests.csproj", "{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSPackage", "VSPackage\VSPackage.csproj", "{2451352F-1CB8-494A-920B-024B8B486185}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSPackage_IntegrationTests", "VSPackage\VSPackage_IntegrationTests\VSPackage_IntegrationTests.csproj", "{D03690D8-EE17-4284-9403-F3F277CF4580}"
|
||||
EndProject
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{91EF78EF-DAB6-4031-AA01-3D127F1E0BCD}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
IntegrationTests.testsettings = IntegrationTests.testsettings
|
||||
UnitTests.testsettings = UnitTests.testsettings
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReswCodeGen.Tests", "ReswCodeGen.Tests\ReswCodeGen.Tests.csproj", "{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSPackage", "VSPackage\VSPackage.csproj", "{2451352F-1CB8-494A-920B-024B8B486185}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSPackage_IntegrationTests", "VSPackage\VSPackage_IntegrationTests\VSPackage_IntegrationTests.csproj", "{D03690D8-EE17-4284-9403-F3F277CF4580}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSPackage_UnitTests", "VSPackage\VSPackage_UnitTests\VSPackage_UnitTests.csproj", "{64F7EAFB-9AF1-4DA4-A4DA-013B4DF10306}"
|
||||
EndProject
|
||||
Global
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
[TestMethod]
|
||||
public void ResourceLoaderInitializedWithClassName()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("new ResourceLoader(currentAssemblyName + \"/Resources\");"));
|
||||
Assert.IsTrue(actual.Contains("ResourceLoader.GetForCurrentView(currentAssemblyName + \"/Resources\");"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
[TestMethod]
|
||||
public void ResourceLoaderInitializedWithClassName()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("new ResourceLoader(currentAssemblyName + \"/Resources\");"));
|
||||
Assert.IsTrue(actual.Contains("ResourceLoader.GetForCurrentView(currentAssemblyName + \"/Resources\");"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
[TestMethod]
|
||||
public void ResourceLoaderInitializedWithClassName()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("New ResourceLoader(currentAssemblyName + \"/Resources\")"));
|
||||
Assert.IsTrue(actual.Contains("ResourceLoader.GetForCurrentView(currentAssemblyName + \"/Resources\")"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
[TestMethod]
|
||||
public void ResourceLoaderInitializedWithClassName()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("New ResourceLoader(currentAssemblyName + \"/Resources\")"));
|
||||
Assert.IsTrue(actual.Contains("ResourceLoader.GetForCurrentView(currentAssemblyName + \"/Resources\")"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,18 +10,25 @@ using Microsoft.CSharp;
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
public class CodeDomCodeGenerator : CodeGenerator, IDisposable
|
||||
{
|
||||
private readonly string className;
|
||||
{
|
||||
private readonly TypeAttributes? classAccessibility;
|
||||
private readonly VisualStudioVersion visualStudioVersion;
|
||||
private readonly string className;
|
||||
private readonly CodeNamespace codeNamespace;
|
||||
private readonly CodeCompileUnit compileUnit;
|
||||
private readonly CodeDomProvider provider;
|
||||
|
||||
public CodeDomCodeGenerator(IResourceParser resourceParser, string className, string defaultNamespace, CodeDomProvider codeDomProvider = null, TypeAttributes? classAccessibility = null)
|
||||
public CodeDomCodeGenerator(IResourceParser resourceParser,
|
||||
string className,
|
||||
string defaultNamespace,
|
||||
CodeDomProvider codeDomProvider = null,
|
||||
TypeAttributes? classAccessibility = null,
|
||||
VisualStudioVersion visualStudioVersion = VisualStudioVersion.VS2012)
|
||||
: base(resourceParser, defaultNamespace)
|
||||
{
|
||||
this.className = className;
|
||||
this.classAccessibility = classAccessibility;
|
||||
this.visualStudioVersion = visualStudioVersion;
|
||||
compileUnit = new CodeCompileUnit();
|
||||
provider = codeDomProvider ?? new CSharpCodeProvider();
|
||||
codeNamespace = new CodeNamespace(defaultNamespace);
|
||||
@@ -29,7 +36,8 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
|
||||
public override string GenerateCode()
|
||||
{
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("--------------------------------------------------------------------------------------------------"));
|
||||
codeNamespace.Comments.Add(
|
||||
new CodeCommentStatement("--------------------------------------------------------------------------------------------------"));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("<auto-generatedInfo>"));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("\tThis code was generated by ResW File Code Generator (http://reswcodegen.codeplex.com)"));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("\tResW File Code Generator was written by Christian Resma Helle"));
|
||||
@@ -40,66 +48,75 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement(string.Empty));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("\tGenerated: " + DateTime.Now.ToString(CultureInfo.InvariantCulture)));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("</auto-generatedInfo>"));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("--------------------------------------------------------------------------------------------------"));
|
||||
codeNamespace.Comments.Add(
|
||||
new CodeCommentStatement("--------------------------------------------------------------------------------------------------"));
|
||||
|
||||
codeNamespace.Imports.Add(new CodeNamespaceImport("Windows.ApplicationModel.Resources"));
|
||||
|
||||
var targetClass = new CodeTypeDeclaration(className)
|
||||
{
|
||||
IsClass = true,
|
||||
IsPartial = true,
|
||||
TypeAttributes = classAccessibility.HasValue ? classAccessibility.Value : TypeAttributes.Public
|
||||
};
|
||||
{
|
||||
IsClass = true,
|
||||
IsPartial = true,
|
||||
TypeAttributes = classAccessibility.HasValue ? classAccessibility.Value : TypeAttributes.Public
|
||||
};
|
||||
|
||||
const string resourceLoaderType = "ResourceLoader";
|
||||
var resourceLoaderField = new CodeMemberField(resourceLoaderType, "resourceLoader")
|
||||
{
|
||||
Attributes = MemberAttributes.Private | MemberAttributes.Static | MemberAttributes.Final
|
||||
};
|
||||
{
|
||||
Attributes = MemberAttributes.Private | MemberAttributes.Static | MemberAttributes.Final
|
||||
};
|
||||
targetClass.Members.Add(resourceLoaderField);
|
||||
|
||||
var constructor = new CodeTypeConstructor();
|
||||
|
||||
var executingAssemblyVar = new CodeVariableDeclarationStatement(typeof(string), "executingAssemblyName");
|
||||
var executingAssemblyInit = new CodeAssignStatement(
|
||||
new CodeVariableReferenceExpression("executingAssemblyName"),
|
||||
new CodeSnippetExpression("Windows.UI.Xaml.Application.Current.GetType().AssemblyQualifiedName"));
|
||||
var executingAssemblySplit = new CodeVariableDeclarationStatement(typeof(string[]), "executingAssemblySplit");
|
||||
var executingAssemblyInit2 = new CodeAssignStatement(
|
||||
new CodeVariableReferenceExpression("executingAssemblySplit"),
|
||||
new CodeMethodInvokeExpression(new CodeVariableReferenceExpression("executingAssemblyName"), "Split", new CodePrimitiveExpression(',')));
|
||||
var executingAssemblyInit3 = new CodeAssignStatement(
|
||||
new CodeVariableReferenceExpression("executingAssemblyName"),
|
||||
new CodeArrayIndexerExpression(new CodeVariableReferenceExpression("executingAssemblySplit"), new CodePrimitiveExpression(1)));
|
||||
var executingAssemblyVar = new CodeVariableDeclarationStatement(typeof (string), "executingAssemblyName");
|
||||
var executingAssemblyInit = new CodeAssignStatement(new CodeVariableReferenceExpression("executingAssemblyName"),
|
||||
new CodeSnippetExpression("Windows.UI.Xaml.Application.Current.GetType().AssemblyQualifiedName"));
|
||||
var executingAssemblySplit = new CodeVariableDeclarationStatement(typeof (string[]), "executingAssemblySplit");
|
||||
var executingAssemblyInit2 = new CodeAssignStatement(new CodeVariableReferenceExpression("executingAssemblySplit"),
|
||||
new CodeMethodInvokeExpression(new CodeVariableReferenceExpression("executingAssemblyName"),
|
||||
"Split",
|
||||
new CodePrimitiveExpression(',')));
|
||||
var executingAssemblyInit3 = new CodeAssignStatement(new CodeVariableReferenceExpression("executingAssemblyName"),
|
||||
new CodeArrayIndexerExpression(new CodeVariableReferenceExpression("executingAssemblySplit"),
|
||||
new CodePrimitiveExpression(1)));
|
||||
|
||||
var currentAssemblyVar = new CodeVariableDeclarationStatement(typeof(string), "currentAssemblyName");
|
||||
var currentAssemblyInit = new CodeAssignStatement(
|
||||
new CodeVariableReferenceExpression("currentAssemblyName"),
|
||||
new CodePropertyReferenceExpression(new CodeTypeOfExpression(className), "AssemblyQualifiedName"));
|
||||
var currentAssemblySplit = new CodeVariableDeclarationStatement(typeof(string[]), "currentAssemblySplit");
|
||||
var currentAssemblyInit2 = new CodeAssignStatement(
|
||||
new CodeVariableReferenceExpression("currentAssemblySplit"),
|
||||
new CodeMethodInvokeExpression(new CodeVariableReferenceExpression("currentAssemblyName"), "Split", new CodePrimitiveExpression(',')));
|
||||
var currentAssemblyInit3 = new CodeAssignStatement(
|
||||
new CodeVariableReferenceExpression("currentAssemblyName"),
|
||||
new CodeArrayIndexerExpression(new CodeVariableReferenceExpression("currentAssemblySplit"), new CodePrimitiveExpression(1)));
|
||||
var currentAssemblyVar = new CodeVariableDeclarationStatement(typeof (string), "currentAssemblyName");
|
||||
var currentAssemblyInit = new CodeAssignStatement(new CodeVariableReferenceExpression("currentAssemblyName"),
|
||||
new CodePropertyReferenceExpression(new CodeTypeOfExpression(className), "AssemblyQualifiedName"));
|
||||
var currentAssemblySplit = new CodeVariableDeclarationStatement(typeof (string[]), "currentAssemblySplit");
|
||||
var currentAssemblyInit2 = new CodeAssignStatement(new CodeVariableReferenceExpression("currentAssemblySplit"),
|
||||
new CodeMethodInvokeExpression(new CodeVariableReferenceExpression("currentAssemblyName"),
|
||||
"Split",
|
||||
new CodePrimitiveExpression(',')));
|
||||
var currentAssemblyInit3 = new CodeAssignStatement(new CodeVariableReferenceExpression("currentAssemblyName"),
|
||||
new CodeArrayIndexerExpression(new CodeVariableReferenceExpression("currentAssemblySplit"),
|
||||
new CodePrimitiveExpression(1)));
|
||||
|
||||
var createResourceLoader = new CodeConditionStatement(
|
||||
new CodeSnippetExpression("executingAssemblyName.Equals(currentAssemblyName)"),
|
||||
new CodeStatement[] // true
|
||||
{
|
||||
new CodeAssignStatement(
|
||||
new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
new CodeObjectCreateExpression(new CodeTypeReference("ResourceLoader"),
|
||||
new CodeSnippetExpression("\"" + className + "\"")))
|
||||
},
|
||||
{
|
||||
visualStudioVersion == VisualStudioVersion.VS2013
|
||||
? new CodeAssignStatement(new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
new CodeMethodInvokeExpression(new CodeTypeReferenceExpression("ResourceLoader"),
|
||||
"GetForCurrentView",
|
||||
new CodeSnippetExpression("\"" + className + "\"")))
|
||||
: new CodeAssignStatement(new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
new CodeObjectCreateExpression(new CodeTypeReference("ResourceLoader"),
|
||||
new CodeSnippetExpression("\"" + className + "\"")))
|
||||
},
|
||||
new CodeStatement[] // false
|
||||
{
|
||||
new CodeAssignStatement(
|
||||
new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
new CodeObjectCreateExpression(new CodeTypeReference("ResourceLoader"),
|
||||
new CodeSnippetExpression("currentAssemblyName + \"/" + className + "\"")))
|
||||
});
|
||||
{
|
||||
visualStudioVersion == VisualStudioVersion.VS2013
|
||||
? new CodeAssignStatement(new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
new CodeMethodInvokeExpression(new CodeTypeReferenceExpression("ResourceLoader"),
|
||||
"GetForCurrentView",
|
||||
new CodeSnippetExpression("currentAssemblyName + \"/" + className + "\"")))
|
||||
: new CodeAssignStatement(new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
new CodeObjectCreateExpression(new CodeTypeReference("ResourceLoader"),
|
||||
new CodeSnippetExpression("currentAssemblyName + \"/" + className + "\"")))
|
||||
});
|
||||
|
||||
constructor.Statements.Add(executingAssemblyVar);
|
||||
constructor.Statements.Add(executingAssemblyInit);
|
||||
@@ -122,12 +139,12 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
continue;
|
||||
|
||||
var property = new CodeMemberProperty
|
||||
{
|
||||
Name = item.Name.Trim(),
|
||||
Attributes = MemberAttributes.Public | MemberAttributes.Static,
|
||||
HasGet = true,
|
||||
Type = new CodeTypeReference(typeof(string))
|
||||
};
|
||||
{
|
||||
Name = item.Name.Trim(),
|
||||
Attributes = MemberAttributes.Public | MemberAttributes.Static,
|
||||
HasGet = true,
|
||||
Type = new CodeTypeReference(typeof (string))
|
||||
};
|
||||
|
||||
property.Comments.Add(new CodeCommentStatement("<summary>", true));
|
||||
property.Comments.Add(new CodeCommentStatement("Localized resource similar to \"" + (item.Value ?? item.Name) + "\"", true));
|
||||
@@ -135,7 +152,8 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
property.GetStatements.Add(
|
||||
new CodeMethodReturnStatement(
|
||||
new CodeMethodInvokeExpression(
|
||||
new CodeFieldReferenceExpression(null, "resourceLoader"), "GetString",
|
||||
new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
"GetString",
|
||||
new CodePrimitiveExpression(item.Name))));
|
||||
|
||||
targetClass.Members.Add(property);
|
||||
@@ -149,7 +167,7 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
|
||||
private string GenerateCodeFromCompileUnit()
|
||||
{
|
||||
var options = new CodeGeneratorOptions { BracingStyle = "C" };
|
||||
var options = new CodeGeneratorOptions {BracingStyle = "C"};
|
||||
|
||||
var code = new StringBuilder();
|
||||
|
||||
@@ -163,16 +181,16 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
|
||||
private bool disposed;
|
||||
|
||||
~CodeDomCodeGenerator()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
~CodeDomCodeGenerator()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool dispose)
|
||||
{
|
||||
if (disposed)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using System.CodeDom;
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Reflection;
|
||||
using EnvDTE;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
@@ -8,7 +11,23 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
public ICodeGenerator Create(string className, string defaultNamespace, string inputFileContents, CodeDomProvider codeDomProvider = null, TypeAttributes? classAccessibility = null)
|
||||
{
|
||||
return new CodeDomCodeGenerator(new ResourceParser(inputFileContents), className, defaultNamespace, codeDomProvider, classAccessibility);
|
||||
return new CodeDomCodeGenerator(new ResourceParser(inputFileContents), className, defaultNamespace, codeDomProvider, classAccessibility, VisualStudioHelper.GetVersion());
|
||||
}
|
||||
}
|
||||
|
||||
public static class VisualStudioHelper
|
||||
{
|
||||
public static VisualStudioVersion GetVersion()
|
||||
{
|
||||
var dte = Package.GetGlobalService(typeof(SDTE)) as DTE;
|
||||
var vsVersion = VisualStudioVersion.VS2012;
|
||||
if (dte != null)
|
||||
{
|
||||
Version dteVersion;
|
||||
if (Version.TryParse(dte.Version, out dteVersion) && dteVersion >= new Version(12, 0))
|
||||
vsVersion = VisualStudioVersion.VS2013;
|
||||
}
|
||||
return vsVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
public enum VisualStudioVersion
|
||||
{
|
||||
VS2012,
|
||||
VS2013,
|
||||
Unknown
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.1.0.*")]
|
||||
[assembly: AssemblyVersion("1.3.0.*")]
|
||||
|
||||
[assembly: InternalsVisibleTo("VSPackage_IntegrationTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010045bd05a5b24c74b83f069df52e138682c2fb8b1ee65cb9d351fd7e8d622308aeb588b2a2975d75da4fe8a392510528baa26a3317809ec064d3cc852f0df94752ad2228d9f2a048ee2858c1e9d505b05f7fb4ede02f34154f75ea50445741c84f5ab1c814358f5fd6a6f08bb3d94284cff0524d5ca9d888c8648bcbc7a1e0a3c8")]
|
||||
[assembly: InternalsVisibleTo("VSPackage_UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010045bd05a5b24c74b83f069df52e138682c2fb8b1ee65cb9d351fd7e8d622308aeb588b2a2975d75da4fe8a392510528baa26a3317809ec064d3cc852f0df94752ad2228d9f2a048ee2858c1e9d505b05f7fb4ede02f34154f75ea50445741c84f5ab1c814358f5fd6a6f08bb3d94284cff0524d5ca9d888c8648bcbc7a1e0a3c8")]
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18033
|
||||
// Runtime Version:4.0.30319.34014
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
||||
@@ -1,9 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
|
||||
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>4.0</OldToolsVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
@@ -119,6 +139,8 @@
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CustomTool\VisualStudioVersion.cs" />
|
||||
<Compile Include="VisualStudio2015Package.cs" />
|
||||
<Compile Include="VisualStudio2013Package.cs" />
|
||||
<Compile Include="CustomTool\ClassNameExtractor.cs" />
|
||||
<Compile Include="CustomTool\CodeDomCodeGenerator.cs" />
|
||||
@@ -173,6 +195,23 @@
|
||||
<IncludeInVSIX>true</IncludeInVSIX>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<UseCodebase>true</UseCodebase>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
VS SDK Notes: This resx file contains the resources that will be consumed from your package by Visual Studio.
|
||||
For example, Visual Studio will attempt to load resource '400' from this resource stream when it needs to
|
||||
load your package's icon. Because Visual Studio will always look in the VSPackage.resources stream first for
|
||||
resources it needs, you should put additional resources that Visual Studio will load directly into this resx
|
||||
file.
|
||||
|
||||
Resources that you would like to access directly from your package in a strong-typed fashion should be stored
|
||||
in Resources.resx or another resx file.
|
||||
-->
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
@@ -127,13 +117,13 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="110" xml:space="preserve">
|
||||
<value>ResW File Code Generator</value>
|
||||
</data>
|
||||
<data name="112" xml:space="preserve">
|
||||
<value>Information about my packageA Visual Studio 2012 Custom Tool for generating a strongly typed helper class for accessing localized resources from a .ResW file.</value>
|
||||
<value>A Visual Studio Custom Tool for generating a strongly typed helper class for accessing localized resources from a .ResW file.</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="400" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\Package.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
||||
+1
@@ -66,6 +66,7 @@
|
||||
<Compile Include="SignOff-Tests\CSharpProjectTests.cs" />
|
||||
<Compile Include="SignOff-Tests\SolutionTests.cs" />
|
||||
<Compile Include="SignOff-Tests\VBProjectTests.cs" />
|
||||
<Compile Include="VisualStudioVersionHelperTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Key.snk" />
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace VSPackage_IntegrationTests
|
||||
{
|
||||
[TestClass]
|
||||
public class VisualStudioHelperTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void GetVersionTests()
|
||||
{
|
||||
var actual = VisualStudioHelper.GetVersion();
|
||||
Assert.AreNotEqual(VisualStudioVersion.Unknown, actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,6 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage
|
||||
{
|
||||
Debug.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
|
||||
base.Initialize();
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage
|
||||
{
|
||||
Debug.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
|
||||
base.Initialize();
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Design.Serialization;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the class that implements the package exposed by this assembly.
|
||||
///
|
||||
/// The minimum requirement for a class to be considered a valid package for Visual Studio
|
||||
/// is to implement the IVsPackage interface and register itself with the shell.
|
||||
/// This package uses the helper classes defined inside the Managed Package Framework (MPF)
|
||||
/// to do it: it derives from the Package class that provides the implementation of the
|
||||
/// IVsPackage interface and uses the registration attributes defined in the framework to
|
||||
/// register itself and its components with the shell.
|
||||
/// </summary>
|
||||
// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is
|
||||
// a package.
|
||||
[PackageRegistration(UseManagedResourcesOnly = true)]
|
||||
// This attribute is used to register the information needed to show this package
|
||||
// in the Help/About dialog of Visual Studio.
|
||||
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
|
||||
[Guid(GuidList.guidVSPackagePkgString)]
|
||||
[DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\14.0")]
|
||||
[ProvideObject(typeof(ReswFileCSharpCodeGenerator))]
|
||||
[ProvideObject(typeof(ReswFileVisualBasicCodeGenerator))]
|
||||
[ProvideObject(typeof(ReswFileCSharpCodeGeneratorInternal))]
|
||||
[ProvideObject(typeof(ReswFileVisualBasicCodeGeneratorInternal))]
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileCSharpCodeGenerator), "ReswFileCodeGenerator", "ResW File Code Generator for C#", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", true)] // csharp
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileVisualBasicCodeGenerator), "ReswFileCodeGenerator", "ResW File Code Generator for VB", "{164B10B9-B200-11D0-8C61-00A0C91E29D5}", true)] // visual basic
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileCSharpCodeGenerator), "PublicReswFileCodeGenerator", "ResW File Code Generator for C#", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", true)] // csharp
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileVisualBasicCodeGenerator), "PublicReswFileCodeGenerator", "ResW File Code Generator for VB", "{164B10B9-B200-11D0-8C61-00A0C91E29D5}", true)] // visual basic
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileCSharpCodeGeneratorInternal), "InternalReswFileCodeGenerator", "ResW File Code Generator for C#", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", true)] // csharp
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileVisualBasicCodeGeneratorInternal), "InternalReswFileCodeGenerator", "ResW File Code Generator for VB", "{164B10B9-B200-11D0-8C61-00A0C91E29D5}", true)] // visual basic
|
||||
public sealed class VisualStudio2015Package : Package
|
||||
{
|
||||
/// <summary>
|
||||
/// Default constructor of the package.
|
||||
/// Inside this method you can place any initialization code that does not require
|
||||
/// any Visual Studio service because at this point the package object is created but
|
||||
/// not sited yet inside Visual Studio environment. The place to do all the other
|
||||
/// initialization is the Initialize method.
|
||||
/// </summary>
|
||||
public VisualStudio2015Package()
|
||||
{
|
||||
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Overridden Package Implementation
|
||||
#region Package Members
|
||||
|
||||
/// <summary>
|
||||
/// Initialization of the package; this method is called right after the package is sited, so this is the place
|
||||
/// where you can put all the initialization code that rely on services provided by VisualStudio.
|
||||
/// </summary>
|
||||
protected override void Initialize()
|
||||
{
|
||||
Debug.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
|
||||
base.Initialize();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
|
||||
<Metadata>
|
||||
<Identity Id="6a4c1726-440f-4b2d-a2e5-711277da6099"
|
||||
Version="1.1"
|
||||
Version="1.4"
|
||||
Language="en-US"
|
||||
Publisher="Christian Resma Helle" />
|
||||
<DisplayName>ResW File Code Generator</DisplayName>
|
||||
@@ -13,8 +13,7 @@
|
||||
<License>License.txt</License>
|
||||
</Metadata>
|
||||
<Installation InstalledByMsi="false">
|
||||
<InstallationTarget Version="[11.0,12.0]"
|
||||
Id="Microsoft.VisualStudio.Premium" />
|
||||
<InstallationTarget Version="[11.0,14.0]" Id="Microsoft.VisualStudio.IntegratedShell" />
|
||||
</Installation>
|
||||
<Dependencies>
|
||||
<Dependency Id="Microsoft.Framework.NDP"
|
||||
|
||||
Reference in New Issue
Block a user