Visual Studio 2017新的.csproj是否与非.net核心项目相关

Luk*_*uka 11 .net csproj visual-studio-2017

我有点困惑.我有Visual Studio 2017的新版本.并已将我的类项目(.net full 4.5)转换为新的.csproj项目格式.然后我尝试对这些项目进行实时测试,但VS现在告诉我.net核心项目jet不支持实时测试.

所以:

  1. 这些项目现在是.Net核心项目吗?
  2. 如果是,我可以将新的.csproj项目文件用于旧的.Net Full 4.x
  3. 我打算将我的应用程序作为WebApi服务部署到Windows服务器,我打算使用NHibernate ORM,因此不包括对.net Core的移动,对我的情况使用这种新的.csproj格式有什么好处吗?
  4. 我可以使用新的.csproj格式并继续使用非.Net Core兼容库,如NHibernate吗?

谢谢

jbt*_*ule 6

我喜欢.net 4.0项目的新格式,更方便的是不必担心将文件包含到项目中也有更少的文件来处理nuget也很好.

你可以从这csproj简单开始

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

  <PropertyGroup>
    <TargetFramework>net40</TargetFramework>
  </PropertyGroup>

</Project>
Run Code Online (Sandbox Code Playgroud)

然后使用visual studio添加回依赖项,将元数据移动到包选项卡并删除AssemblyInfo.cs,然后自定义您自定义的任何内容(提示有时排除和重新包含文件可以帮助获取默认行为,如果你有东西奇怪,例如T4模板).它将是一个更清晰的文件,并且将来更容易更新到.netstandard(甚至是多目标).

下面是我使用多目标和一些T4模板的开源项目的示例,这是完整的文件,项目中自动包含40个C#文件,因为它们位于以下目录中:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFrameworks>netstandard1.5;net40</TargetFrameworks>
        <Description>(pronounced dyna-mighty) flexes DLR muscle to do meta-mazing things in .net</Description>
        <Company>Ekon Benefits</Company>
        <Authors/>
        <Copyright>Copyright 2017 Ekon Benefits</Copyright>
        <AssemblyVersion>1.5.0.0</AssemblyVersion>
        <FileVersion>1.5.0.0</FileVersion>
        <PackageProjectUrl>https://github.com/ekonbenefits/dynamitey</PackageProjectUrl>
        <PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
        <PackageTags>dynamic metaprogramming dlr reflection currying tuples expando latetypes</PackageTags>
        <IncludeSymbols>True</IncludeSymbols>
        <IncludeSource>True</IncludeSource>
        <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
        <PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
        <SignAssembly>True</SignAssembly>
        <AssemblyOriginatorKeyFile>sn.snk</AssemblyOriginatorKeyFile>
        <DelaySign>False</DelaySign>
        <Version>1.5.0</Version>
    </PropertyGroup>
    <ItemGroup Condition="'$(TargetFramework)'!='net40'">
        <PackageReference Include="Microsoft.CSharp" Version="4.3.0"/>
        <PackageReference Include="System.ComponentModel" Version="4.3.0"/>
    </ItemGroup>
    <ItemGroup Condition="'$(TargetFramework)'=='net40'">
        <Reference Include="Microsoft.CSharp"/>
    </ItemGroup>
    <ItemGroup>
        <None Update="InlineLambdas.tt">
            <Generator>TextTemplatingFileGenerator</Generator>
            <LastGenOutput>InlineLambdas.cs</LastGenOutput>
        </None>
        <None Update="ThisFunctions.tt">
            <Generator>TextTemplatingFileGenerator</Generator>
            <LastGenOutput>ThisFunctions.cs</LastGenOutput>
        </None>
    </ItemGroup>
    <ItemGroup>
        <Compile Update="InlineLambdas.cs">
            <DesignTime>True</DesignTime>
            <AutoGen>True</AutoGen>
            <DependentUpon>InlineLambdas.tt</DependentUpon>
        </Compile>
        <Compile Update="ThisFunctions.cs">
            <DesignTime>True</DesignTime>
            <AutoGen>True</AutoGen>
            <DependentUpon>ThisFunctions.tt</DependentUpon>
        </Compile>
    </ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)