11
votes

I'm a bit confused. I have the new version of Visual Studio 2017. And have converted my class projects (.net full 4.5) to the new .csproj project format. Then I tried to run live tests on those projects, but VS now informs me that live testing is not supported on .net core projects jet.

So:

  1. Are those projects now .Net Core projects?
  2. If Yes, can I use the new .csproj project file for the old good .Net Full 4.x
  3. I am planning to deploy my application as WebApi services to a windows server only, and I'm planning to use NHibernate ORM, so movig to .net Core is excluded, are there any benefit of using this new .csproj format for my case?
  4. Can I use the new .csproj format and keep using non .Net Core compatible libraries like NHibernate?

Thanks

1
You should probably consider using .NET Standard as your portable class libraries, if the API provided is enough for you. Then you can reference it in all types of projects, full .NET Framework or .NET Core.Neme
Ok, You didn't answer any of my question, also I wrote in my post that I plan to use NHibernate which is NOT .Net core and .Net standard compatible.Luka
I didn't, that's why I posted a comment, not an answer. Sorry for trying to help.Neme
Hi, I'm currently asking me the same question. Do you have any updates on this ?Antoine Blanchet
With the latest update to VS 2017, all projects are converted in the new .csproj file format. And yes, you can still use the full .net framework ie (.net framework 4.7.1).Luka

1 Answers

6
votes

I like the new format for .net 4.0 projects, it's way easier not having to worry about including files to your project also having less files to deal with nuget is nice as well.

You can start out with a csproj as simple as this

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

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

</Project>

And then use visual studio to add back in your dependencies, move the meta data to the packages tab and remove AssemblyInfo.cs, and then customize anything you had custom (hint sometimes excluding and re-including files can help to get the default behavior if you have something strange e.g. T4 templates). It will be a much cleaner file and way easier to update to .netstandard in the future (or even multitarget).

Here is an example of an opensource project of mine using multi-target and some T4 templates this is the full file and there are like 40 C# files automatically included in the project because they are in the directory:

<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>