madskristensen / ShortcutExporter

Visual Studio extension
479 stars 215 forks source link

Won't compile in VS2017 #14

Closed jamespharvey20 closed 7 years ago

jamespharvey20 commented 7 years ago

I ran into 2 issues compiling with (not merely installing onto) VS2017 RTM+1 (26228.9).

(1) Building from git master gives multiple errors like

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2545,5): warning MSB3283: Cannot find wrapper assembly for type library "EnvDTE". Verify that (1) the COM component is registered correctly and (2) your target platform is the same as the bitness of the COM component. For example, if the COM component is 32-bit, your target platform must not be 64-bit.

... Also for EnvDTE80, EnvDTE90, EnvDTE100, and Microsoft.VisualStudio.CommandBars

Apparently there's a breaking change in VS2017. See: https://developercommunity.visualstudio.com/content/problem/15434/cannot-find-wrapper-assembly-for-type-library-envd.html

Following those instructions, removing the COM references, and adding references to assemblies/extensions for these 5 gets passed this issue.

(2) But, then, these 11 errors occur. I've never used C# before so am out of my element.

1>Task "Csc" 1> C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /errorendlocation /preferreduilang:en-US /highentropyva+ /link:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\envdte.dll" /link:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\envdte100.dll" /link:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\envdte80.dll" /link:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\envdte90.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.2\Microsoft.CSharp.dll" /link:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.CommandBars.dll" /reference:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.OLE.Interop.dll" /reference:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VSSDK\VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.Immutable.10.0.dll" /reference:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VSSDK\VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.Immutable.11.0.dll" /reference:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.Shell.Interop.10.0.dll" /link:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.Shell.Interop.11.0.dll" /reference:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.Shell.Interop.8.0.dll" /reference:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.Shell.Interop.9.0.dll" /reference:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.Shell.Interop.dll" /reference:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.TextManager.Interop.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.2\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.2\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.2\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.2\System.Design.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.2\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.2\System.Drawing.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.2\System.Windows.Forms.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.2\System.Xml.dll" /reference:C:\Windows\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll /debug+ /debug:full /keyfile:Key.snk /optimize- /out:obj\Debug\ShortcutExporter.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Static Analysis Tools\Rule Sets\MinimumRecommendedRules.ruleset" /subsystemversion:6.00 /resource:obj\Debug\VSPackage.resources /resource:obj\Debug\MadsKristensen.ShortcutExporter.Resources.resources /target:library /utf8output Guids.cs Resources.Designer.cs ShortcutExporterPackage.cs Properties\AssemblyInfo.cs PkgCmdID.cs "C:\Users\mdarling\AppData\Local\Temp.NETFramework,Version=v4.6.2.AssemblyAttributes.cs" obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs 1> Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn 1> Microsoft (R) Visual C# Compiler version 2.0.0.61501 1> Copyright (C) Microsoft Corporation. All rights reserved. 1>R:\ShortcutExporter.git\ShortcutExporter\ShortcutExporterPackage.cs(24,51,24,58): error CS0246: The type or namespace name 'Package' could not be found (are you missing a using directive or an assembly reference?) 1>R:\ShortcutExporter.git\ShortcutExporter\ShortcutExporterPackage.cs(20,6,20,25): error CS0246: The type or namespace name 'PackageRegistrationAttribute' could not be found (are you missing a using directive or an assembly reference?) 1>R:\ShortcutExporter.git\ShortcutExporter\ShortcutExporterPackage.cs(20,6,20,25): error CS0246: The type or namespace name 'PackageRegistration' could not be found (are you missing a using directive or an assembly reference?) 1>R:\ShortcutExporter.git\ShortcutExporter\ShortcutExporterPackage.cs(21,6,21,34): error CS0246: The type or namespace name 'InstalledProductRegistrationAttribute' could not be found (are you missing a using directive or an assembly reference?) 1>R:\ShortcutExporter.git\ShortcutExporter\ShortcutExporterPackage.cs(21,6,21,34): error CS0246: The type or namespace name 'InstalledProductRegistration' could not be found (are you missing a using directive or an assembly reference?) 1>R:\ShortcutExporter.git\ShortcutExporter\ShortcutExporterPackage.cs(22,6,22,25): error CS0246: The type or namespace name 'ProvideMenuResourceAttribute' could not be found (are you missing a using directive or an assembly reference?) 1>R:\ShortcutExporter.git\ShortcutExporter\ShortcutExporterPackage.cs(22,6,22,25): error CS0246: The type or namespace name 'ProvideMenuResource' could not be found (are you missing a using directive or an assembly reference?) 1>R:\ShortcutExporter.git\ShortcutExporter\ShortcutExporterPackage.cs(20,26,20,49): error CS0246: The type or namespace name 'UseManagedResourcesOnly' could not be found (are you missing a using directive or an assembly reference?) 1>R:\ShortcutExporter.git\ShortcutExporter\ShortcutExporterPackage.cs(21,58,21,72): error CS0246: The type or namespace name 'IconResourceID' could not be found (are you missing a using directive or an assembly reference?) 1>R:\ShortcutExporter.git\ShortcutExporter\ShortcutExporterPackage.cs(28,33,28,43): error CS0115: 'ShortcutExporterPackage.Initialize()': no suitable method found to override 1>Done executing task "Csc" -- FAILED.

jamespharvey20 commented 7 years ago

Got past this. Removed reference to "Microsoft.VisualStudio.Shell.12.0", added ".15.0". Added reference to "Microsoft.VisualStudio.Shell.Framework". Right clicked "ShortcutExporter", and in properties, set Target framework to .NET Framework 4.6.2 rather than 4.5. Again, I've never worked with C# before, so this could be the wrong way.

madskristensen commented 7 years ago

You need the lowest version of VS installed that the extension targets. In this case VS2013. This is how it works for extension projects that supports anything earlier than VS2015