Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Update eligible projects to new SDK format. #1761
Now we're using VS2017 we can use the new simplified SDK-style .csproj format. This PR updates the projects that can be updated to this format. It also enables
WPF projects and VSSDK projects can't use the SDK format yet. In addition
I've seen VS extension projects using the new project system in Microsoft repos, for example here:
but haven't found any info or documentation on that. Maybe this is an experimental & undocumented feature?
Sorry to disappoint, but when I looked at the VSIX project, I didn't see any ROI in getting it working with the new SDK. It's possible Oren has something up his sleeve—I know he has WPF working on the new csproj SDK. https://github.com/onovotny/MSBuildSdkExtras#msbuildsdkextras
I don't understand what the problem with WPF is? I just tried creating a new WPF project & changing the csproj and everything worked fine.
The only problem is that
So using that, now the csproj looks like:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net46</TargetFramework> <OutputType>WinExe</OutputType> </PropertyGroup> <ItemGroup> <Reference Include="System.Xaml" /> <Reference Include="WindowsBase" /> <Reference Include="PresentationCore" /> <Reference Include="PresentationFramework" /> </ItemGroup> <ItemGroup> <None Remove="**\*.xaml" /> <ApplicationDefinition Include="App.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </ApplicationDefinition> <Page Include="**\*.xaml" Exclude="App.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Compile Update="**\*.xaml.cs"> <DependentUpon>%(Filename)</DependentUpon> <SubType>Code</SubType> </Compile> </ItemGroup> </Project>
everything works perfectly and it is stable when adding/removing xaml files inside VS (it doesn't modify the project file to add duplicate items).
for a library, the includes would be simplified to:
<ItemGroup> <None Remove="**\*.xaml" /> <Page Include="**\*.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Compile Update="**\*.xaml.cs"> <DependentUpon>%(Filename)</DependentUpon> <SubType>Code</SubType> </Compile> </ItemGroup>
I'm confused where this project gets its VS SDK references from.
@jcansdale Hey, here's an example of a new-style VSIX project by @sharwell: https://github.com/tunnelvisionlabs/JustMyCodeToggle/blob/master/Tvl.VisualStudio.JustMyCodeToggle/Tvl.VisualStudio.JustMyCodeToggle.csproj
changed the title from
WIP: Update eligible projects to new SDK format.
Update eligible projects to new SDK format.
Sep 5, 2018
Looks good in general, I'm just wondering where the settings for code analysis are. The csproj point to a specific ruleset, but this new format doesn't seem to have that setting or any configuration to enable/disable and set warnings as errors. Given how many warnings are on CI, I'm guessing it's using the default ruleset for these?
Yes it's using the default ruleset for now, and not enabling warnings as errors. The new analyser has a lot more checks that are very useful and that I don't want to disable (such as always using
My reasoning was that we should fix these warnings and enable warnings as errors in a separate PR.
This seems to work well and it's impressive how much the size of .csproj files have been reduced. I think if we delay merging this now, we'll have nasty merge issues further down the road. I'd say LGTM since we're at the beginning a of a dev cycle.