• 让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>
  • 相关阅读:
    python 登录与注册
    python 深浅拷贝
    列表|字典|集合推导式
    正则表达式——笔记
    Python thread
    allure报告自定义logo和名称
    回归测试用例编写思路
    测试用例规范【如何编写测试用例】
    git与pycharm的使用详解(git+gitlab+pycham)
    接口自动化
  • 原文地址:https://www.cnblogs.com/LiChen19951127/p/11090388.html
Copyright © 2020-2023  润新知