使用COMReference创建一个自包含的exe

时间:2019-12-18 14:34:23

标签: c# .net-core compilation exe visual-studio-2019

我正在尝试发布一个自包含的exe文件。

可悲的是,我的所有Google工作都没有帮助。我的代码中有对WindowsInstaller的COM引用。

到目前为止,这是我的csproj文件

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <RootNamespace>MSI_Info</RootNamespace>
    <RuntimeIdentifiers>win10-x64;win10-x86</RuntimeIdentifiers>
  </PropertyGroup>

  <ItemGroup>
    <COMReference Include="WindowsInstaller">
      <Guid>{000C1092-0000-0000-C000-000000000046}</Guid>
      <VersionMajor>1</VersionMajor>
      <VersionMinor>0</VersionMinor>
      <Lcid>1033</Lcid>
      <WrapperTool>tlbimp</WrapperTool>
      <Isolated>False</Isolated>
      <EmbedInteropTypes>True</EmbedInteropTypes>
    </COMReference>
  </ItemGroup>

</Project>

代码托管在这里https://github.com/SmuSmu/MSI-Info

要获得一个简单的exe文件不是那么容易:)

0 个答案:

没有答案