Support formatting ASP.NET vNext projects
I have an library that is written in C#, but I converted it to a .kproj (ASP.NET vNext library) so that my ASP.NET vNext website could also use its logic.
CodeFormatter skips over this project and doesn't format it. so I have to manually create a .csproj, add the .cs files, and run the formatter tool again.
@jasonmalinowski is there any way to load up ASP.Net vNext projects in Roslyn today? Right now the CodeFormatter just uses a MSBuildWorkspace. If there is an easy way to load this project type I'm sure it wouldn't take much work to get the code formatter to support it.
It's possible but not very nice right now. We're working on an API that will make this less sucky.
@davidfowl is there a GitHub issue I can track for this API? Once it's available I'd like to try it out here.
Not really, we're mostly layering things differently (some in NuGet, some in XRE) to make this possible. I'll update this thread when we get closer to having something useful.
@conniey Please also note that you don't have to convert your existing library project to a kproj to be able to reference it from your ASP.NET 5 app as long as you are ok with the app running on the full .NET Framework. You can reference csproj based projects from an ASP.NET 5 app. You would need to port your existing project only if you wanted to be able to run on .NET Core.
@conniey @danroth27 We also plan on adding ASP.NET 5 as a target from a Portable Library so you wont need to have a seperate project file and multiple builds if you want to have you're shared logic applicable to multiple places.
@danroth27 The application that uses the library, I want to run on .NET Core. :) Thanks for the tip though.
This issue also occurs with .xproj files. Here is my workaround:
- Add CodeFormatterWorkaround.csproj in your the directory.
- Then run
codeformatter .\CodeFormatterWorkaround.csproj
This recursively formats all *.cs files without needing to specify them individually. Hooray!
CodeFormatterWorkaround.csproj contains only the following:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Include="*.cs" />
<Compile Include=".\**\*.cs" />
</ItemGroup>
<Target Name="Compile">
<Csc Sources="@(Compile)"/>
</Target>
</Project>
See also: http://stackoverflow.com/questions/6914046/can-ms-build-include-all-library-project-code-files-without-specifying-them-indi