Skip to content

VSIX is only generated using .NET Framework MSBuild, not Core #15617

@jjonescz

Description

@jjonescz
  • This issue is blocking
  • This issue is causing unreasonable pain

Running dotnet build doesn't produce a VSIX, only the full framework msbuild.exe does. That's because Core MSBuild is disabled here:

<Import Project="VisualStudio.targets" Condition="'$(UsingToolVSSDK)' == 'true' and ('$(IsVsixProject)' == 'true' or '$(IsSwixProject)' == 'true' or '$(GeneratePkgDefFile)' == 'true') and '$(MSBuildRuntimeType)' != 'Core'"/>

I'm not sure what's the reason for that because having something like the following in the project file makes dotnet build produce vsix as well:

<Project>

  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

  <PropertyGroup>
    <VsixVersion Condition="'$(VsixVersion)' == ''">42.42.42.4242424</VsixVersion>
    <DeployExtension Condition="'$(MSBuildRuntimeType)' == 'Core'">false</DeployExtension>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.VisualStudio.Sdk" />
    <PackageReference Include="Microsoft.VSSDK.BuildTools" PrivateAssets="all" />
  </ItemGroup>

  <Target Name="GetVsixVersion" Returns="$(VsixVersion)">
    <PropertyGroup>
      <VsixVersion Condition="'$(VersionSuffixDateStamp)' != ''">$(VersionPrefix).$(VersionSuffixDateStamp)$(VersionSuffixBuildOfTheDayPadded)</VsixVersion>
    </PropertyGroup>
  </Target>

  <!-- Order matters here. VSSDK appends to PrepareForRunDependsOn but Microsoft.NET.Sdk overwrites it. See https://github.com/dotnet/msbuild/issues/2393. -->
  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
  <Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="Exists('$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets') and '$(OS)' == 'Windows_NT' And '$(Architecture)' == 'x64'" />

</Project>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions