Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用COMReference创建自包含的exe_C#_.net Core_Compilation_Exe_Visual Studio 2019 - Fatal编程技术网

C# 使用COMReference创建自包含的exe

C# 使用COMReference创建自包含的exe,c#,.net-core,compilation,exe,visual-studio-2019,C#,.net Core,Compilation,Exe,Visual Studio 2019,我正在尝试发布一个自包含的exe文件 遗憾的是,我所有的谷歌工作都没有帮助。我的代码中有一个指向WindowsInstaller的COM引用 到目前为止,这是我的csproj文件 <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp3.1</Targe

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

遗憾的是,我所有的谷歌工作都没有帮助。我的代码中有一个指向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>

Exe
netcoreapp3.1
MSI_信息
win10-x64;win10-x86
{000C1092-0000-0000-C000-0000000000 46}
1.
0
1033
tlbimp
假的
真的
代码托管在这里


获得一个简单的exe文件并不容易:)

您想要实现什么?你已经试过什么了?我不知道什么东西不适合你。我想要一个exe文件。但编译后仍然有一些链接到dll的,它不会运行没有它。即使将缺少的dll复制到发布目录也无济于事。当你说self-contained exe时,你的意思是说应用程序应该在输出文件夹中没有dll文件作为依赖项的情况下运行吗?你是如何让它生成的?MSBuild的.NET核心版本不支持COMReferencesTry
/p:PublishSingleFile=True
选项(AFAIK仅适用于
dotnet publish
命令)