Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the new .Csproj without .Net core #1688

Closed
cable729 opened this Issue Feb 10, 2017 · 17 comments

Comments

Projects
None yet
9 participants
@cable729
Copy link

cable729 commented Feb 10, 2017

Apologies if this is the wrong repository.

Is it possible to use the new .Csproj format without targeting .Net core? I.e. targeting .NET 4.5.x or 4.6.x?

@davkean

This comment has been minimized.

Copy link
Member

davkean commented Feb 10, 2017

Yes, the SDK tooling works for .NET Framework without explicitly targeting .NET Core. However, there are caveats. We've focused this release entirely about making just compile of Console Apps, Libraries and ASP.NET Core on NET Framework work. You cannot use the tooling build/use .NET Framework projects that contain Windows Forms, WPF, Workflow, ASP.NET Web Forms, etc.

Paging @onovotny, who does this a bit and can probably point to some guidance he's written.

@cable729

This comment has been minimized.

Copy link
Author

cable729 commented Feb 10, 2017

Oh gotcha. Thanks for the quick response. That's too bad about the ASP.net web forms. Is supporting these other projects on the roadmap after the release of VS 2017, or are there other more urgent priorities?

@davkean

This comment has been minimized.

Copy link
Member

davkean commented Feb 10, 2017

We wanted to unify csproj tooling across all the .NET stacks this release, but it turned into a fairly large undertaking (who knew 15 years of tooling would be hard to replace!). I don't have timelines when we'll do it, and what order we'll do it in, but I'm confident that we'll be able to move the majority of projects over to using the new project system (http://github.com/dotnet/roslyn-project-system), and then a significant portion of those over to the SDK-based format in future releases.

@cable729

This comment has been minimized.

Copy link
Author

cable729 commented Feb 10, 2017

OK, thanks for the information that you're able to provide. I haven't heard of this SDK-based format. Do you have a link or keywords for where I can learn more? Google doesn't turn up anything.

@magol

This comment has been minimized.

Copy link

magol commented Feb 10, 2017

Is it any plans to simplyfi vcxproj to in the future?

@davkean

This comment has been minimized.

Copy link
Member

davkean commented Feb 10, 2017

We doc'd some of it here: https://docs.microsoft.com/en-us/dotnet/articles/core/preview3/tools/csproj, you can see an example template here: https://github.com/dotnet/sdk/blob/master/src/Templates/ProjectTemplates/CSharp/.NETCore/CSharpConsoleApplication/ProjectTemplate.csproj. That "Sdk" attribute basically auto-imports a props at the top of the project and a targets at the bottom.

@davkean

This comment has been minimized.

Copy link
Member

davkean commented Feb 10, 2017

@magol To be honest, no plans as of yet. The C++ team are aware of the work we're doing, and once we've landed .NET Core scenarios lots of the new features we've added will just work for them, but I cannot promise anything.

@magol

This comment has been minimized.

Copy link

magol commented Feb 10, 2017

@davkean Is it any list of the new features? For example, what new features do you think will be usable in vcxproj?
Do the c++ team have any github repository or mail list?

@davkean

This comment has been minimized.

Copy link
Member

davkean commented Feb 10, 2017

An example of a couple of the new features that vcxproj might be able to benefit from, is auto-reload (ie project file changes on disk, we pick up the changes automatically), or project file editing while the project is open. C++ team does not have a repo or a mailing list (that I'm aware of), Report a Problem/Suggestion from VS would be away to give feedback to them.

@magol

This comment has been minimized.

Copy link

magol commented Feb 10, 2017

@davkean Great improvements. But i can not expect any simplifications of the xml in the vcxproj file?

@davkean

This comment has been minimized.

Copy link
Member

davkean commented Feb 10, 2017

@magol I can only speak for things that I work on, I don't work on C++ - so can't talk about any format improvements that they may or may not.

@onovotny

This comment has been minimized.

Copy link

onovotny commented Feb 10, 2017

You can build any project type with the SDK style builds. The main trick is to set the LanaguageTargets to the correct project specific targets for the type of project you want to build. I talk about how it all works here: https://oren.codes/2017/01/04/multi-targeting-the-world-a-single-project-to-rule-them-all/

That said, there are some additional things you'll need to add for certain project types that need additional actions - metadata for specific things like WPF pages, etc.

This issue is working on what's needed for WPF: dotnet/project-system#1467. The specific globs to add are here: Microsoft/VSProjectSystem#169

Should look something like:

<Compile Update="**\*.xaml.cs">
        <DependentUpon>%(Filename)</DependentUpon>      
        <SubType>Code</SubType>
</Compile>
			
<Page Include="**\*.xaml">
        <Generator>MSBuild:Compile</Generator>
        <SubType>Designer</SubType>      
</Page>
@tomkuijsten

This comment has been minimized.

Copy link

tomkuijsten commented Aug 29, 2017

@davkean is there any roadmap or GitHub issue for tracking progress of the "new csproj format for all project types"?

@davkean

This comment has been minimized.

Copy link
Member

davkean commented Aug 29, 2017

https://github.com/dotnet/project-system/blob/master/docs/repo/roadmap.md - make note there is no dates associated with the "16.0" milestone that its associated with.

@bdovaz

This comment has been minimized.

Copy link

bdovaz commented Sep 4, 2017

Anyone got this working? I'm able to compile it but I lost intellisense in VS 2017.

This is my csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <LanguageTargets>$(MSBuildExtensionsPath)\$(VisualStudioVersion)\Bin\Microsoft.CSharp.targets</LanguageTargets>
    <OutputType>winexe</OutputType>
    <TargetFramework>net462</TargetFramework>
    <DebugType>Full</DebugType>
    <ApplicationIcon>res\ico\icon.ico</ApplicationIcon>
    <OutputTypeEx>winexe</OutputTypeEx>
    <StartupObject />
  </PropertyGroup>

  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
    <TransformOnBuild>True</TransformOnBuild>
    <TransformOutOfDateOnly>false</TransformOutOfDateOnly>
  </PropertyGroup>

  <Import Project="$(VSToolsPath)\TextTemplating\Microsoft.TextTemplating.targets" />

  <ItemGroup>
    <!-- App.xaml -->
    <ApplicationDefinition Include="App.xaml" SubType="Designer" Generator="MSBuild:UpdateDesignTimeXaml" />

    <!-- XAML elements -->
    <Page Include="**\*.xaml" SubType="Designer" Generator="MSBuild:UpdateDesignTimeXaml" Exclude="App.xaml" />
    <Compile Update="**\*.xaml.cs" SubType="Designer" DependentUpon="%(Filename)" />
    <Compile Include="$(IntermediateOutputPath)**\*.g.cs" Visible="false" />
    <None Include="$(ProjectDir)obj" Visible="false" />

    <!-- Resources -->
    <EmbeddedResource Update="Properties\Resources.resx" Generator="ResXFileCodeGenerator" LastGenOutput="Resources.Designer.cs" />
    <Compile Update="Properties\Resources.Designer.cs" AutoGen="True" DependentUpon="Resources.resx" DesignTime="True" />

    <!-- Settings -->
    <None Update="Properties\Settings.settings" Generator="SettingsSingleFileGenerator" LastGenOutput="Settings.Designer.cs" />
    <Compile Update="Properties\Settings.Designer.cs" AutoGen="True" DependentUpon="Settings.settings" />

    <None Update="App.config">
      <TransformOnBuild>true</TransformOnBuild>
    </None>
    <None Update="App.Debug.config">
      <IsTransformFile>True</IsTransformFile>
    </None>
    <None Update="App.Release.config">
      <IsTransformFile>True</IsTransformFile>
    </None>
  </ItemGroup>

  <ItemGroup>
    <Reference Include="PresentationCore" />
    <Reference Include="PresentationFramework" />
    <Reference Include="System.Xaml" />
    <Reference Include="WindowsBase" />
  </ItemGroup>

  <ItemGroup>
    <Compile Remove="Publish\**" />
    <EmbeddedResource Remove="Publish\**" />
    <None Remove="Publish\**" />
    <Page Remove="Publish\**" />
  </ItemGroup>

  <PropertyGroup>
    <AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>
  </PropertyGroup>

  <Import Project="$(MSBuildSDKExtrasTargets)" Condition="Exists('$(MSBuildSDKExtrasTargets)')" />
</Project>
@damageboy

This comment has been minimized.

Copy link

damageboy commented Oct 29, 2017

@onovotny thanks for the great information dump on how to migrate existing WPF projects...

I was wondering if you could help in porting Windows Forms project to the new csproj.

I assume that except for <LanguageTargets> I also need to find the names of the generators for windows form classes... right?

In other words...
In "old style" csproj I have:

    <Compile Include="AmazingForm.cs">
      <SubType>Form</SubType>
    </Compile>

I'm assuming the .cs files that are form based need to have a special generator in order for them to compile....

What would that Generator be?

@buddalasunil999

This comment has been minimized.

Copy link

buddalasunil999 commented May 8, 2018

Anyone aware of how to include Telerik reports in the new project template?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.