zoukankan      html  css  js  c++  java
  • 让VS2019支持.NET Core WinForms和WPF设计器的临时办法(转)

    .net core 3.0 Preview 6,vs2019 16.1.4 暂时还不支持Winform designer 

    解决方案:

     将Form1修改为其他名字

     

    WinForm   编辑项目文件  加入 TargetFrameworks   使其支持net472;

    <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
    
      <PropertyGroup>
        <OutputType>WinExe</OutputType>
        <TargetFrameworks>net472;netcoreapp3.0</TargetFrameworks>
        <UseWindowsForms>true</UseWindowsForms>
        <LangVersion>7.3</LangVersion>
      </PropertyGroup>
      <ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
        <Reference Include="System" />
        <Reference Include="System.Core" />
        <Reference Include="System.Xml.Linq" />
        <Reference Include="System.Data.DataSetExtensions" />
        <Reference Include="Microsoft.CSharp" />
        <Reference Include="System.Data" />
        <Reference Include="System.Deployment" />
        <Reference Include="System.Drawing" />
        <Reference Include="System.Net.Http" />
        <Reference Include="System.Windows.Forms" />
        <Reference Include="System.Xml" />
      </ItemGroup>
      <ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
        <!-- add From files to here to enable designer -->
        <Compile Update="Form1.cs">
          <SubType>Form</SubType>
        </Compile>
      </ItemGroup>
    </Project>

    现在已经支持WPF的设计器了   以下参考

    WPF

    <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
    
      <PropertyGroup>
        <OutputType>WinExe</OutputType>
        <TargetFrameworks>net472;netcoreapp3.0</TargetFrameworks>
        <UseWPF>true</UseWPF>
      </PropertyGroup>
      <ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
        <Reference Include="System" />
        <Reference Include="System.Data" />
        <Reference Include="System.Xml" />
        <Reference Include="Microsoft.CSharp" />
        <Reference Include="System.Core" />
        <Reference Include="System.Xml.Linq" />
        <Reference Include="System.Data.DataSetExtensions" />
        <Reference Include="System.Net.Http" />
        <Reference Include="System.Xaml">
          <RequiredTargetFramework>4.0</RequiredTargetFramework>
        </Reference>
        <Reference Include="WindowsBase" />
        <Reference Include="PresentationCore" />
        <Reference Include="PresentationFramework" />
      </ItemGroup>
      <ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
        <!-- add files to here to enable designer -->
        <Compile Update="App.xaml.cs">
          <DependentUpon>App.xaml</DependentUpon>
          <SubType>Code</SubType>
        </Compile>
        <Compile Update="MainWindow.xaml.cs">
          <DependentUpon>MainWindow.xaml</DependentUpon>
          <SubType>Code</SubType>
        </Compile>
      </ItemGroup>
    </Project>
  • 相关阅读:
    iOS 微信分享提示 未验证应用
    iOS 升级xcode12后原项目模拟器运行报错
    ZK进程监控
    kakafka
    mysql 通过使用联全索引优化Group by查询
    4. php反序列化从入门到放弃(放弃篇)
    微慕小程序专业版V3.5发布-小商店
    C++ Singleton模式
    C语言的clone与mmap调用
    InnoDB MVCC机制
  • 原文地址:https://www.cnblogs.com/LiChen19951127/p/11090388.html
Copyright © 2011-2022 走看看