Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The value 'arm64' is invalid according to its datatype #142

Closed
ndepend opened this issue Nov 1, 2022 · 20 comments
Closed

The value 'arm64' is invalid according to its datatype #142

ndepend opened this issue Nov 1, 2022 · 20 comments

Comments

@ndepend
Copy link
Collaborator

ndepend commented Nov 1, 2022

I attempt to compile our AnyCPU extension against in the arm64 but get this error:

'http://schemas.microsoft.com/developer/vsx-schema/2011:ProductArchitecture' element is invalid - 
The value 'arm64' is invalid according to its datatype 

I read the Target Visual Studio 2022 (ARM64) documentation and don't figure what is wrong. The same error popups on both VS 2022 17.3.6 (latest) and 17.4.0 (preview 5) latest. Windows version is 10 19044.2130 and the machine is not ARM (Processor Intel(R) Xeon(R) E-2176M).

http://schemas.microsoft.com/developer/vsx-schema/2011 in the vsixmanifest is also used in this screenshot in the documentation mentioned above.

Those pkg are updated to latest versions in the .csproj:

    <PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.3.32804.24" ExcludeAssets="runtime" />
    <PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.4.2118">

If I remove pro and enterprise tags in the vsixmanifest this doesn't help.

arm64 VS preview

@ErikEJ
Copy link

ErikEJ commented Nov 1, 2022

This is probably not a good repo for this kind of issue.

I can build this without any problems:

<Installation>
		<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[16.0,17.0)" />
		<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0,18.0)">
			<ProductArchitecture>amd64</ProductArchitecture>			
		</InstallationTarget>
		<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0,18.0)">
			<ProductArchitecture>arm64</ProductArchitecture>			
		</InstallationTarget>      
    </Installation>

(You dont need Pro and Enterprise)

Maybe your build is configured to treat schema validation issues as error?

@ndepend
Copy link
Collaborator Author

ndepend commented Nov 1, 2022

Thanks @ErikEJ, we have no <TreatWarningsAsErrors>false</TreatWarningsAsErrors> in our csproj nor use the switch warnaserror in the command line. Anyway if it would be a warning in the first place this is somethig that must be fixed.

Could it be that somewhere locally I have an outdated version of http://schemas.microsoft.com/developer/vsx-schema/2011 or http://schemas.microsoft.com/developer/vsx-schema-design/2011?

Btw, I have the same error as squiggle when editing the vsixmanifest in VS 2022 and somehow it could be related to this stackoverflow Q/A but I don't find the solution.
image

@ndepend
Copy link
Collaborator Author

ndepend commented Nov 1, 2022

Also on the same machine same VS 2022 Community17.3.6 (latest) I can compile the MIDL repo but still get the same warning in the vsixmanifest editor. This advocates that something in our project or solution transforms this warning into an error but we have no <TreatWarningsAsErrors>false</TreatWarningsAsErrors> in our csproj nor use the switch warnaserror in the command line. Also it would be great that this warning gets fixed.

image

@ErikEJ
Copy link

ErikEJ commented Nov 1, 2022

Please share your entire vsixmanfest file as text.

@ndepend
Copy link
Collaborator Author

ndepend commented Nov 1, 2022

Here it is with arm64 sections commented:

<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
  <Metadata>
    <Identity Id="ae98c9e5-8e14-4c92-b45a-c4fd24a49123" Version="2022.2.1.9664" Language="en-US" Publisher="ZEN PROGRAM HLD" />
    <DisplayName>NDepend 2022.2.1</DisplayName>
    <Description xml:space="preserve">NDepend 2022.2.1 extension for Microsoft Visual Studio. For more information about NDepend, visit https://www.ndepend.com. Copyright © 2004–2022 ZEN PROGRAM HLD</Description>
    <MoreInfo>https://www.ndepend.com/features</MoreInfo>
    <License>PackageLicense.rtf</License>
    <GettingStartedGuide>https://www.ndepend.com/docs/getting-started-with-ndepend</GettingStartedGuide>
    <ReleaseNotes>https://www.ndepend.com/whatsnew</ReleaseNotes>
    <Icon>Resources\icon.png</Icon>
    <PreviewImage>Resources\preview.png</PreviewImage>
    <Tags>static analysis, rule, issue, technical debt, code quality, code smell, diff, baseline, trend, dashboard, dependency, architecture, graph</Tags>
  </Metadata>
  <Installation>
    <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0,18.0)">
      <ProductArchitecture>amd64</ProductArchitecture>
    </InstallationTarget>
    <!-- <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0,18.0)">
      <ProductArchitecture>arm64</ProductArchitecture>
    </InstallationTarget> -->
    <InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[17.0,18.0)">
      <ProductArchitecture>amd64</ProductArchitecture>
    </InstallationTarget>
    <!-- <InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[17.0,18.0)">
      <ProductArchitecture>arm64</ProductArchitecture>
    </InstallationTarget> -->
    <InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[17.0,18.0)">
      <ProductArchitecture>amd64</ProductArchitecture>
    </InstallationTarget>
    <!-- <InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[17.0,18.0)">
      <ProductArchitecture>arm64</ProductArchitecture>
    </InstallationTarget> -->
  </Installation>
  <Dependencies>
    <Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" Version="[4.0,)" />
  </Dependencies>
  <Assets>
    <Asset Type="Microsoft.VisualStudio.VsPackage" Path="NDepend.VisualStudioExtension4.dll" />
    <Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%|" />
  </Assets>
  <Prerequisites>
    <Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[17.0,18.0)" DisplayName="Visual Studio core editor" />
  </Prerequisites>
</PackageManifest>

@ErikEJ
Copy link

ErikEJ commented Nov 1, 2022

Unable to get build errors with this (slightly modfied) vsixmanifest:

<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
  <Metadata>
    <Identity Id="ae98c9e5-8e14-4c92-b45a-c4fd24a49123" Version="2022.2.1.9664" Language="en-US" Publisher="ZEN PROGRAM HLD" />
    <DisplayName>NDepend 2022.2.1</DisplayName>
    <Description xml:space="preserve">NDepend 2022.2.1 extension for Microsoft Visual Studio. For more information about NDepend, visit https://www.ndepend.com. Copyright © 2004–2022 ZEN PROGRAM HLD</Description>
    <MoreInfo>https://www.ndepend.com/features</MoreInfo>
    <!--<License>PackageLicense.rtf</License>-->
    <GettingStartedGuide>https://www.ndepend.com/docs/getting-started-with-ndepend</GettingStartedGuide>
    <ReleaseNotes>https://www.ndepend.com/whatsnew</ReleaseNotes>
    <Icon>Resources\icon.png</Icon>
    <PreviewImage>Resources\preview.png</PreviewImage>
    <Tags>static analysis, rule, issue, technical debt, code quality, code smell, diff, baseline, trend, dashboard, dependency, architecture, graph</Tags>
  </Metadata>
  <Installation>
    <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0,18.0)">
      <ProductArchitecture>amd64</ProductArchitecture>
    </InstallationTarget>
     <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0,18.0)">
      <ProductArchitecture>arm64</ProductArchitecture>
    </InstallationTarget> 
    <InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[17.0,18.0)">
      <ProductArchitecture>amd64</ProductArchitecture>
    </InstallationTarget>
     <InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[17.0,18.0)">
      <ProductArchitecture>arm64</ProductArchitecture>
    </InstallationTarget> 
    <InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[17.0,18.0)">
      <ProductArchitecture>amd64</ProductArchitecture>
    </InstallationTarget>
     <InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[17.0,18.0)">
      <ProductArchitecture>arm64</ProductArchitecture>
    </InstallationTarget> 
  </Installation>
  <Dependencies>
    <Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" Version="[4.0,)" />
  </Dependencies>
  <Assets>
    <Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
  </Assets>
  <Prerequisites>
    <Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[17.0,18.0)" DisplayName="Visual Studio core editor" />
  </Prerequisites>
</PackageManifest>

@ErikEJ
Copy link

ErikEJ commented Nov 1, 2022

Assume it is your dependencies and/or ,csproj settings

@ndepend
Copy link
Collaborator Author

ndepend commented Nov 2, 2022

Thanks @ErikEJ. So finally our extension compile in VS 2022 17.3.6 with <ProductArchitecture>arm64</ProductArchitecture>. Indeed some changes had to be done in the .csproj, mostly adding those versions

<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.4.2118" />

I still think that the warning mentioned above (about arm64 tag) is something that should be fixed.


Unfortunatly we're not yet there because our build process now fails with a strange exception.

"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\msbuild.exe" .\OurSolution.sln /p:Configuration=Debug /p:VisualStudioVersion=17.0

In command line build we now get System.MissingMethodException: Method notfound:'Microsoft.VisualStudio.ExtensionManager.ProductArchitecture Microsoft.VisualStudio.ExtensionManager.ProductArchitectureExtensions.ToProductArchitecture(System.String).

Could it be that somehow compiling within VS 2022 17.3.6 uses something from the VS 17.4.0 Preview 5 install (also installed on the machine), but command line compilation cannot use it hence the odd MissingMethodException ?

The whole stacktrace that appears in command line:

C:\Users\pat\.nuget\packages\microsoft.vssdk.buildtools\17.4.2118\tools\VSSDK\Microsoft.VsSDK.targets(1210,5): error MSB4018: The "CreatePkgDef" task failed unexpectedly. [C:\My\NDepend\7.Current\NDepend.VisualStudioExtension4\NDepend.VisualStudioExtension4.csproj]
C:\Users\pat\.nuget\packages\microsoft.vssdk.buildtools\17.4.2118\tools\VSSDK\Microsoft.VsSDK.targets(1210,5): error MSB4018: System.MissingMethodException: Method notfound:'Microsoft.VisualStudio.ExtensionManager.ProductArchitecture Microsoft.VisualStudio.ExtensionManager.ProductArchitectureExtensions.ToProductArchitecture(System.String)'. [C:\My\NDepend\7.Current\NDepend.VisualStudioExtension4\NDepend.VisualStudioExtension4.csproj]
C:\Users\pat\.nuget\packages\microsoft.vssdk.buildtools\17.4.2118\tools\VSSDK\Microsoft.VsSDK.targets(1210,5): error MSB4018:    at Microsoft.VisualStudio.Sdk.BuildTasks.FolderLocator.GetSDKToolsPath2(String arch, String installationPath) [C:\My\NDepend\7.Current\NDepend.VisualStudioExtension4\NDepend.VisualStudioExtension4.csproj]
C:\Users\pat\.nuget\packages\microsoft.vssdk.buildtools\17.4.2118\tools\VSSDK\Microsoft.VsSDK.targets(1210,5): error MSB4018:    at Microsoft.VisualStudio.Sdk.BuildTasks.CreatePkgDef.GenerateFullPathToTool() [C:\My\NDepend\7.Current\NDepend.VisualStudioExtension4\NDepend.VisualStudioExtension4.csproj]C:\Users\pat\.nuget\packages\microsoft.vssdk.buildtools\17.4.2118\tools\VSSDK\Microsoft.VsSDK.targets(1210,5): error MSB4018:    at Microsoft.Build.Utilities.ToolTask.ComputePathToTool() [C:\My\NDepend\7.Current\NDepend.VisualStudioExtension4\NDepend.VisualStudioExtension4.csproj]
C:\Users\pat\.nuget\packages\microsoft.vssdk.buildtools\17.4.2118\tools\VSSDK\Microsoft.VsSDK.targets(1210,5): error MSB4018:    at Microsoft.Build.Utilities.ToolTask.Execute()[C:\My\NDepend\7.Current\NDepend.VisualStudioExtension4\NDepend.VisualStudioExtension4.csproj]
C:\Users\pat\.nuget\packages\microsoft.vssdk.buildtools\17.4.2118\tools\VSSDK\Microsoft.VsSDK.targets(1210,5): error MSB4018:    atMicrosoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\My\NDepend\7.Current\NDepend.VisualStudioExtension4\NDepend.VisualStudioExtension4.csproj]
C:\Users\pat\.nuget\packages\microsoft.vssdk.buildtools\17.4.2118\tools\VSSDK\Microsoft.VsSDK.targets(1210,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() [C:\My\NDepend\7.Current\NDepend.VisualStudioExtension4\NDepend.VisualStudioExtension4.csproj]

@ErikEJ
Copy link

ErikEJ commented Nov 2, 2022

I think <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> would be enough.

But it is really hard to help you when you are only sharing fragments of your .csproj.

@snickler
Copy link

snickler commented Nov 2, 2022

@ndepend - Hmmm. Try setting the TFM to 4.7.2 and see if that works.

I just tried from a brand new project in Visual Studio 2022 17.3.6, updating the NuGet packages, and building. It works both within VS and from Developer Command Prompt and simply running msbuild /t:rebuild

CSProj:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <MinimumVisualStudioVersion>17.0</MinimumVisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
  </PropertyGroup>
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <ProjectGuid>{A3471CEB-7039-4BA4-BE2D-9CDF5AE225C6}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>VSIXProject1</RootNamespace>
    <AssemblyName>VSIXProject1</AssemblyName>
    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
    <GeneratePkgDefFile>true</GeneratePkgDefFile>
    <UseCodebase>true</UseCodebase>
    <IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
    <IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
    <IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
    <CopyBuildOutputToOutputDirectory>true</CopyBuildOutputToOutputDirectory>
    <CopyOutputSymbolsToOutputDirectory>true</CopyOutputSymbolsToOutputDirectory>
    <StartAction>Program</StartAction>
    <StartProgram Condition="'$(DevEnvDir)' != ''">$(DevEnvDir)devenv.exe</StartProgram>
    <StartArguments>/rootsuffix Exp</StartArguments>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="VSIXProject1Package.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="source.extension.vsixmanifest">
      <SubType>Designer</SubType>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Reference Include="System" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.3.32804.24" ExcludeAssets="runtime">
      <IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.4.2118">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Extension Manifest:

<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
  <Metadata>
	<Identity Id="VSIXProject1.e19e8e6c-daed-45eb-8a04-b6ce3f0349a2" Version="1.0" Language="en-US" Publisher="Jeremy" />
	<DisplayName>VSIXProject1</DisplayName>
	<Description>Empty VSIX Project.</Description>
  </Metadata>
  <Installation>
	<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0, 18.0)">
	  <ProductArchitecture>amd64</ProductArchitecture>
	</InstallationTarget>
	  <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0, 18.0)">
		  <ProductArchitecture>arm64</ProductArchitecture>
	  </InstallationTarget>	  
  </Installation>
  <Dependencies>
	<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
  </Dependencies>
  <Prerequisites>
	<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[17.0,18.0)" DisplayName="Visual Studio core editor" />
  </Prerequisites>
  <Assets>
	<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
  </Assets>
</PackageManifest>

image

buildout.txt

@ndepend
Copy link
Collaborator Author

ndepend commented Nov 2, 2022

Thanks @snickler, actually on the same machine I can compile MIDL arm64, so again something in our csproj provokes the issue

"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\msbuild.exe" "C:\My\Tests\OnMIDL\MIDL.sln" /p:Configuration=Debug /p:VisualStudioVersion=17.0

See our csproj content below:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0">
  <PropertyGroup>
    <MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
  </PropertyGroup>
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>****</ProjectGuid>
    <ProjectTypeGuids>********</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>NDepend.VisualStudioExtension</RootNamespace>
    <AssemblyName>NDepend.VisualStudioExtension4</AssemblyName>
    <SignAssembly>true</SignAssembly>
    <DelaySign>false</DelaySign>
    <AssemblyOriginatorKeyFile>********.snk</AssemblyOriginatorKeyFile>
    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\bin\Debug\Lib\</OutputPath>
    <DefineConstants>TRACE;DEBUG;VSIX4;CODE_ANALYSIS</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <CopyVsixExtensionFiles>False</CopyVsixExtensionFiles>
    <DeployExtension>True</DeployExtension>
    <Prefer32Bit>false</Prefer32Bit>
    <CopyVsixExtensionLocation>C:\Temp\VSIX</CopyVsixExtensionLocation>
    <NoWarn>MSB3277</NoWarn>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\bin\Release\Lib\</OutputPath>
    <DefineConstants>TRACE;VSIX4</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <RunCodeAnalysis>false</RunCodeAnalysis>
    <Prefer32Bit>false</Prefer32Bit>
    <CopyVsixExtensionFiles>False</CopyVsixExtensionFiles>
    <CopyVsixExtensionLocation>C:\Temp\VSIX</CopyVsixExtensionLocation>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Community.VisualStudio.VSCT" Version="16.0.29.6" PrivateAssets="all" />
    <PackageReference Include="Community.VisualStudio.Toolkit.17" Version="17.0.430" ExcludeAssets="Runtime" />
    <PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.4.2118" />
    <Reference Include="*******">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\bin\Debug\Lib\*************.dll</HintPath>
      <Private>False</Private>
    </Reference>
    
    ... 5 other of our DLLs ...
    
    <Reference Include="netstandard" />
    <Reference Include="PresentationCore" />
    <Reference Include="PresentationFramework" />
    <Reference Include="System" />
    <Reference Include="System.ComponentModel.Composition" />
    <Reference Include="System.Core" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xaml" />
    <Reference Include="WindowsBase" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="***.cs">
      <Link>****.cs</Link>
    </Compile>
    
    ... around 30 .cs files ...
    
    <None Include="packages.config" />
  </ItemGroup>
  <ItemGroup>
    <None Include="..\******.snk">
      <Link>***********.snk</Link>
    </None>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\VSPackage.resx">
      <MergeWithCTO>true</MergeWithCTO>
      <ManifestResourceName>VSPackage</ManifestResourceName>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="VSIXStuff\source.extension.vsixmanifest">
      <SubType>Designer</SubType>
    </None>
  </ItemGroup>
  <ItemGroup>
    <VSCTCompile Include="VSIXStuff\NDepend.vsct">
      <ResourceName>Menus.ctmenu</ResourceName>
      <SubType>Designer</SubType>
    </VSCTCompile>
  </ItemGroup>
  <ItemGroup>
    <Content Include="PackageLicense.rtf">
      <IncludeInVSIX>true</IncludeInVSIX>
    </Content>
    <Content Include="Resources\icon.png">
      <IncludeInVSIX>true</IncludeInVSIX>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Resource Include="Resources\Package.ico" />
    <Content Include="Resources\preview.png">
      <IncludeInVSIX>true</IncludeInVSIX>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <None Include="Resources\NDepend32x32.ico" />
    <None Include="Resources\CodeMenuImages.png" />
    <None Include="Resources\GlobalMenuImages.png" />
    <None Include="Resources\MiscImages.png" />
  </ItemGroup>
  <ItemGroup />
  <PropertyGroup>
    <UseCodebase>true</UseCodebase>
  </PropertyGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
  <PropertyGroup>
    <PreBuildEvent>$(SolutionDir)\BuildProcess\PreBuildEvents.bat  "$(TargetPath)"  "$(TargetFileName)"  "$(TargetDir)"  "$(TargetName)"</PreBuildEvent>
  </PropertyGroup>
  <PropertyGroup>
  <PostBuildEvent>$(SolutionDir)\BuildProcess\VSIXPostBuildEvents.bat 2 $(TargetDir)</PostBuildEvent> 
  </PropertyGroup>
</Project>

@ErikEJ
Copy link

ErikEJ commented Nov 2, 2022

This looks old:

<PackageReference Include="Community.VisualStudio.VSCT" Version="16.0.29.6" PrivateAssets="all" />

@ndepend
Copy link
Collaborator Author

ndepend commented Nov 3, 2022

@ErikEJ this must not be that since Include="Community.VisualStudio.VSCT" Version="16.0.29.6" is in the MIDL .csproj that compiles fine on the same machine.

image

Also I scanned with our tool NDepend assemblies in the directories C:\Users\pat\.nuget\packages\microsoft.vssdk.buildtools\17.4.2118\tools\vssdk and the method Microsoft.VisualStudio.ExtensionManager.ProductArchitectureExtensions.ToProductArchitecture(String) is in the assembly Microsoft.VisualStudio.ExtensionEngine.dll v17.0.0.0 so somehow another version of this assembly is loaded by MSBuild just in our build context (and not the MIDL build context):

image

Untitled


Also if arm64 is commented in the vsixmanifest, command line compilation works with

<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.3.2095" />

but not with (still get the MissingMethodException):

    <PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.4.2118" /> 

(I remind the compilation within VS2022 17.3.6 works with arm64 uncommented in the vsixmanifest + <PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.4.2118" /> in the .csproj)

@snickler
Copy link

snickler commented Nov 3, 2022

Hmm @ndepend try adding <GeneratePkgDefFile>true</GeneratePkgDefFile> in your properties to see if that works.

Also <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> is missing from the propertygroup. Those are two things I see that are in both the MIDL csproj and my sample

@ankitvarmait
Copy link

Thank you for your feedback. In order for us to investigate this further, could you provide us with the following information?

  • Could you please use the latest version of the VS 17.4+ and check if you see any warnings in the extension manifest editor?
  • Could you please share the details which version of the VS you are using to compile the project?

Also,
I took the latest code from the repo and can build the project (targets arm64 as well) succefully.

@ndepend
Copy link
Collaborator Author

ndepend commented Nov 4, 2022

@ankitvarmait build with VS 17.4.0 Preview 5 made it, finally <ProductArchitecture>amd64</ProductArchitecture> went into our .vsix. Now we're asking to a beta tester to see if it works on an ARM64 machine (all our assemblies are compiled against AnyCPU). When VS 17.4.0 will be released?
Thanks to everyone for the help

@ErikEJ
Copy link

ErikEJ commented Nov 4, 2022

@ankitvarmait I am guessing next week, when .NET 7 is released

@snickler
Copy link

snickler commented Nov 4, 2022

@ndepend Next week at .NET Conf. Since .NET 7 GA is officially supported on 17.4

@ankitvarmait
Copy link

Thank you for your feedback. We'll close this issue since it works with the the latest preview version. If you have any new questions, please see our guidelines and report a new problem reproducible steps.

Thanks

@maiak
Copy link
Member

maiak commented Nov 8, 2022

Closing since it works with the newest version.

@maiak maiak closed this as completed Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants