-
Notifications
You must be signed in to change notification settings - Fork 446
Conversation
|
VS should be fixed now. |
<RemoveDir Directories="$(SignalRClientDistFolder)" /> | ||
</Target> | ||
|
||
<Import Project="$(MSBuildThisFileDirectory)\..\..\build\repo.targets" /> |
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 import is no longer needed.
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, remove this.
|
||
<Import Project="..\..\build\common.props" /> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard1.0</TargetFramework> |
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.
We probably need: <IsPackable>false</IsPackable>
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.
Why does a typescript project need a target framework?
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 needed to pretend it's a csproj otherwise project references did not work.
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.
And it could not be open in VS
@@ -0,0 +1,34 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project Sdk="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.
Is this even a typescript project?
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.
Probably don't need to reference 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.
Similar to above - it makes project references work.
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.
To clarify - currently there is no Typescript support/tooling for VS2017. I wanted to see what they did in previous versions and if you create a "Typescript project" in VS2015 it will be a *.csproj. I tried using their MSBuild tasks from VS2015 but they are compiled against .NET Framework and "our" MSBuild could not load them. When they have tools for VS2017 and netcore MSBuild tasks we need to make sure that there is an easy way to use the latest version of the compiler (i.e. you don't have to reinstall typescript MSBuild/tools if you want to move to a new compiler 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.
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.
Does this still work with VS code? |
build/repo.targets
Outdated
</Target> | ||
|
||
<Target Name="RestoreNpm" AfterTargets="Restore"> | ||
<Target Name="RestoreNpm"> |
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.
Why did you remove this from the lifecycle?
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.
It's a mistake. I originally depended on this target directly but I decided not to do this anymore because it adds at least a few secs to the build even if there is nothing to install. Will revert this change.
@@ -15,6 +15,7 @@ | |||
|
|||
<ItemGroup> | |||
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.SignalR\Microsoft.AspNetCore.SignalR.csproj" /> | |||
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.SignalR.Client.TS\Microsoft.AspNetCore.SignalR.Client.TS.csproj" /> |
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.
Try adding ReferenceOutputAssembly="false"
to all ProjectReference to the TS project. This will suppress NuGet attempting to use the project reference as a compile reference.
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.
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.
Turned out that I can't do that. With this settings I can build from command line but when I build with VS it fails to build the project due to:
Cannot find project info for 'C:\Source\SignalR-Core\src\Microsoft.AspNetCore.SignalR.Client.TS\Microsoft.AspNetCore.SignalR.Client.TS.csproj'. This can indicate a missing project reference.
<RemoveDir Directories="$(SignalRClientDistFolder)" /> | ||
</Target> | ||
|
||
<Import Project="$(MSBuildThisFileDirectory)\..\..\build\repo.targets" /> |
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, remove this.
@@ -0,0 +1,34 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project Sdk="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.
Probably don't need to reference Microsoft.NET.Sdk.
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Inputs Include="*.ts;" /> |
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.
Not sure how well VS does with this project. You might try using None
instead so VS recognizes the files.
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.
VS showed the files just fine.
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 was also able to build the ts client.
@@ -0,0 +1,34 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
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: suggest changing extension to .proj
. This isn't a C# project.
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 started with .proj but VS refused to add it to the solution. Hence changing to project to pretend it's a .csproj
@davidfowl - VS Code should work. I plugged in things to MSBuild but under the cover it sill invokes npm/gulp to build things. This has not changed. |
My only hesitation to this is that we're abusing what ProjectReference and Microsoft.NET.Sdk are meant to do, and this may be fragile. There are other ways to enforce build dependencies that may be cleaner, such as adding a |
@natemcmaster - this needs to be a .csproj because VS otherwise won't open it why using |
412e370
to
6ae650c
Compare
🆙📅 |
6ae650c
to
08df7b3
Compare
<Exec Command="npm run gulp -- --gulpfile $(MSBuildThisFileDirectory)gulpfile.js build-ts-client" /> | ||
</Target> | ||
|
||
<Target Name="Clean"> |
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 target will be overridden by Microsoft.NET.Sdk because this project has implicit top/bottom imports. If you want to override this target, use explicit imports instead. Example:
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<!-- regular project stuff here -->
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<!-- Override default SDK targets-->
<Target Name="Clean" />
<Target Name="Build" />
</Project>
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.
Will do.
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.
Adding this results in the following build warnings:
warning MSB4011: "C:\Users\XXXX\AppData\Local\Microsoft\dotnet\sdk\1.0.0-rc4-004913\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.targets" cannot be imported again. It was already imported at "C:\source\SignalR-Core\src\Microsoft.AspNetCore.SignalR.Client.TS\Microsoft.AspNetCore.SignalR.Client.TS.csproj (30,3)". This is most likely a build authoring error. This subsequent import will be ignored.
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.
Does your file say <Project>
or <Project Sdk="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.
Oh, I see - it did say <Project Sdk="microsoft.net.sdk">
- I did not notice it that it should have been removed.
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.
Without Sdk attribute on Project it does work indeed. I decided however to use AfterTargets. The equivalence between the Sdk attribute and Imports is magic and we cannot override the Build target anyways.
<TargetFrameworks>netcoreapp1.1;net46</TargetFrameworks> | ||
<TargetFrameworks>netcoreapp1.1</TargetFrameworks> | ||
<PreserveCompilationContext>true</PreserveCompilationContext> | ||
<OutputType>Exe</OutputType> |
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.
PreserveCompilationContext and OutputType are not required. These are the default settings for Microsoft.NET.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.
OK
@@ -3,38 +3,31 @@ | |||
<Import Project="..\..\build\common.props" /> | |||
|
|||
<PropertyGroup> | |||
<TargetFrameworks>netcoreapp1.1;net46</TargetFrameworks> | |||
<TargetFrameworks>netcoreapp1.1</TargetFrameworks> |
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: make this singular TargetFramework
Given that there aren't TypeScript tools for 2017 yet, I'm OK with using a |
- Creating an MSBuild project for the TS client - Adding project references to the TS client project from projects that need the client - (ensures the correct targets dependency graph and prevents building the client multiple times and related races) - Removing gulp tasks from individual projects (allows containing npm only in the TS client source and node tests) - Using incremental compilation to build the TS client only when inputs change (prevents building the client multiple times or when not needed at all) - Removing `npm install` from all the projects (takes up to 10 seconds even if there is nothing to restore) - npm packages will still be installed when running full build (if needed) or need to be installed manually
61cfc68
to
75b8249
Compare
npm install
from all the projects (takes up to 10 seconds even if there is nothing to restore) - npm packages will still be installed when running full build (if needed) or need to be installed manually