-
Notifications
You must be signed in to change notification settings - Fork 517
Migrate to csproj #703
Migrate to csproj #703
Conversation
<PackageTags>aspnetcore;aspnetcoremvc;nodeservices</PackageTags> | ||
<RepositoryType>git</RepositoryType> | ||
<RepositoryUrl>git://github.com/aspnet/javascriptservices</RepositoryUrl> | ||
<NetStandardImplicitPackageVersion>1.6.1-*</NetStandardImplicitPackageVersion> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
JavaScriptServices.sln
Outdated
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Debug|x64 = Debug|x64 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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\**\*"> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)" /> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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\**\*"> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this 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.
With these updates everything is now only VS2017+ only, correct? @SteveSandersonMS @natemcmaster |
@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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wtf is this 😄
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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. |
2124890
to
56cdd09
Compare
src/common.props
Outdated
<RepositoryType>git</RepositoryType> | ||
<RepositoryUrl>https://github.com/aspnet/javascriptservices</RepositoryUrl> | ||
|
||
<GenerateNeutralResourcesLanguageAttribute>true</GenerateNeutralResourcesLanguageAttribute> |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
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 |
using System.Resources; | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: AssemblyMetadata("Serviceable", "True")] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
)
Doesn't affect other scenarios (e.g., directly using Kestrel, which was already this fast).
…aSpa for consistency)
…l there's a better pure front-end project type
…s whenever it sees .ts files
…ld\" dir for consistency.
There was a problem hiding this 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> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Period.
Oh and we should figure out why the CLA bot doesn't like you... |
9a433dd
to
0429fbf
Compare
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 intodev
, 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 bothproject.json
and.csproj
files, and have aglobal.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.