Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Conversation

SteveSandersonMS
Copy link
Member

This PR moves all the projects to .csproj and rebuilds the .sln to work with VS017RC. I'll squash all these commits before merging it into dev, but it's probably easier to review split up into all these commits.

There's still one more thing to be done - change the templates projects so they use RC4 tooling by default (currently they contain both project.json and .csproj files, and have a global.json that says to use preview2 tooling, because the project generator can emit projects of both types), but that won't affect the actual .csproj files which are the main aspect of the review I think.

<PackageTags>aspnetcore;aspnetcoremvc;nodeservices</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>git://github.com/aspnet/javascriptservices</RepositoryUrl>
<NetStandardImplicitPackageVersion>1.6.1-*</NetStandardImplicitPackageVersion>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why VS puts this NetStandardImplicitPackageVersion specification into all the projects. @natemcmaster - do you know if we need it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends. Should these packages target NETStandard.Library 1.6.0 or 1.6.1? The SDK defaults to 1.6.0. NetStandardImplicitPackageVersion will change that version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks. It seems they are needed, because some of the dependency packages target 1.6.1, and if this one doesn't specify the same, it produces downgrade warnings. I'll move these lines to a common build props file.

Copy link
Contributor

@natemcmaster natemcmaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, there are a lot of lines of code (most likely generated by dotnet-migrate) that are redundant and can be removed.

I suggest putting all common properties -- such AssemblyOriginatorKeyFile, RepositoryUrl, etc -- into a single file the repo and using "Import" to pull them into individual projects. See https://github.com/aspnet/FileSystem/blob/dev/build/common.props for example.

Also, consider using the MSBuild properties <Company>, <Copyright>, and <Product>. The SDK can use these to auto-generate AssemblyInfo.cs and will put these in the nuspec of the generated nuget packages.

Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was probably added automatically by VS or dotnet-migrate, but in general we don't need the x64 and x86 solution configurations for our projects. Consider removing these.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

global.json Outdated
"projects": ["src"],
"sdk": { "version": "1.0.0-preview2-1-003177" }
}
"projects": ["src"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this whole file. The "projects" value is deprecated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: you can remove the following settings as they are the default value:

PreserveCompilationContext
AssemblyName
OutputType
RuntimeFrameworkVersion

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

</PropertyGroup>

<ItemGroup>
<Content Update="appsettings.json;ClientApp;node_modules;typings\**\*;Views\**\*;tsconfig.json;tsd.json;web.config;webpack.*.js;wwwroot\**\*">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test it, but I'm pretty sure this can be removed. Microsoft.Net.Sdk.Web will publish these files by default. If anything, you may want to exclude some of these from publish, such as node_moduels, tsconfig, webpack, etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<AssemblyName>NodeServicesExamples</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>NodeServicesExamples</PackageId>
<RuntimeFrameworkVersion>1.1.0</RuntimeFrameworkVersion>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an unsupported mix of runtime version and TFM. Change the framework to netcoreapp1.1 and remove this property.

This is true of several other projects in the PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<PackageId>Microsoft.AspNetCore.NodeServices</PackageId>
<PackageTags>aspnetcore;aspnetcoremvc;nodeservices</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>git://github.com/aspnet/javascriptservices</RepositoryUrl>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest changing this to https:// instead. git:// isn't browser-friendly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

</PropertyGroup>

<ItemGroup>
<EmbeddedResource Include="Content\**\*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise here. These globs are probably not required.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are files to be embedded from Content, so leaving this as-is, but please let me know if you still think this is wrong.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the Exclude part

<OutputType>Exe</OutputType>
<PackageId>WebApplicationBasic</PackageId>
<RuntimeFrameworkVersion>1.1.0</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these be dropped? I didn't see anything in the list of dependencies that would require these fallback frameworks anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why the migration util put those there. I don't really even know what effect they would ever have. Removing.


<ItemGroup>
<Compile Remove="node_modules\**\*" />
<Content Update="appsettings.json;Views\**\*;web.config;wwwroot\**\*">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed. It is already the default for Sdk.Web projects.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,45 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On all of your samples and template projects, consider adding <IsPackable>false</IsPackable>. This will allow you to execute dotnet pack on the solution and get packages for only those projects that should actually produce nuget packages.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@Eilon Eilon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to what @natemcmaster said, will look again once his comments are addressed.

@MarkPieszak
Copy link
Contributor

With these updates everything is now only VS2017+ only, correct? @SteveSandersonMS @natemcmaster

@natemcmaster
Copy link
Contributor

natemcmaster commented Feb 23, 2017

@MarkPieszak it means building this repo requires VS 2017, VS Code + C# 1.7, or .NET Core CLI 1.0.0-rc4

Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{BDE761D9-8E1C-4FB1-BB86-110393C59176}"
EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "test", "test\", "{A01B46C2-53D8-499D-8CDE-68E3E7B52804}"
ProjectSection(WebsiteProperties) = preProject
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wtf is this 😄

Copy link
Member Author

@SteveSandersonMS SteveSandersonMS Feb 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes indeed. When are we getting a project type that means "just show me the files and don't try to build anything"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never seen this section either. Is this a carry-over from ASP.NET 4?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@natemcmaster It's a "Web site" project (as in, just a folder full of files, without any .NET). It's pretty nasty, but does VS2017 have any better way of working with front-end resources? It no longer seems to have the "TypeScript" project type. People have been talking about having an "html" project type forever, but I still don't see anything resembling that in VS2017.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for clarifying. I'm not sure if VS 2017 has these project types, and I haven't run into this requirement yet. But hey, if it makes it easier to work with files in VS 2017, go for it. It shouldn't affect compilation.

@SteveSandersonMS
Copy link
Member Author

Thanks @natemcmaster for the feedback. I learned a lot! You're right that most of this stuff was produced by the migration tool, but it's nice to get it into a cleaner state.

src/common.props Outdated
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/aspnet/javascriptservices</RepositoryUrl>

<GenerateNeutralResourcesLanguageAttribute>true</GenerateNeutralResourcesLanguageAttribute>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These Generate*Attribute settings default to true so you can remove them, but you still need to set the values for the generate attributes by setting properties for <Company> and etc.

These are the default proeprties we set in all of our other aspnet projects.

    <Product>Microsoft ASP.NET Core</Product>
    <NeutralLanguage>en-US</NeutralLanguage>
    <Company>Microsoft Corporation.</Company>
    <Authors>Microsoft</Authors>
    <Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
    <ProjectUrl>https://asp.net</ProjectUrl>
    <RequireLicenseAcceptance>true</RequireLicenseAcceptance>
    <Serviceable>true</Serviceable>

To clarify something...you don't see this in the build/common.props files in other github.com/aspnet projects, but instead you will see a PackageReference to "Internal.AspNetCore.Sdk". (see below).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pointers. I've added a reference to Internal.AspNetCore.Sdk (in common.props) and moved a few files around to make it pretty much the same as the other ASP.NET Core projects.

@natemcmaster
Copy link
Contributor

Consider also adding a PackageReference to Internal.AspNet.Sdk to the projects in src/*.csproj that produce official packages. Internal.AspNet.Sdk is defined in our build tools repo and is how we set these common properties and build targets. We did this via package to make it easier to put common MSBuild code in one place instead of duplicating across 50-ish repos.

Internal.AspNetCore.Sdk extends the build to generate AssemblyMetadata("CommitHash", (git commit)) and AssemblyMetadata("Serviceable", "True"). These things aren't provided by the default targets from Microsoft.NET.Sdk.

using System.Resources;
using System.Runtime.CompilerServices;

[assembly: AssemblyMetadata("Serviceable", "True")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless you add Internal.AspNetCore.Sdk, you'll need to keep this one. It's not generated by Microsoft.NET.Sdk.

cref https://github.com/aspnet/BuildTools/blob/e4be7e105de6c3bf2e882bb76f3565305ca5a46d/src/Internal.AspNetCore.Sdk/build/GenerateAssemblyInfo.targets

Copy link
Member Author

@SteveSandersonMS SteveSandersonMS Feb 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (by referencing Internal.AspNetCore.Sdk)

Copy link
Contributor

@Eilon Eilon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, period!

<Import Project="..\build\common.props" />

<PropertyGroup>
<Description>Socket-based RPC for Microsoft.AspNetCore.NodeServices</Description>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

End sentence with a period

.

<Import Project="..\build\common.props" />

<PropertyGroup>
<Description>Helpers for building single-page applications on ASP.NET MVC Core</Description>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Period.

@Eilon
Copy link
Contributor

Eilon commented Feb 24, 2017

Oh and we should figure out why the CLA bot doesn't like you...

@SteveSandersonMS SteveSandersonMS merged commit a79bc75 into dev Feb 28, 2017
@SteveSandersonMS SteveSandersonMS deleted the csproj-migration branch February 28, 2017 09:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants