Skip to content

Commit 0ab917d

Browse files
fix: Hot reload breaking (#126)
Fixes #125
1 parent 88300e1 commit 0ab917d

7 files changed

+34
-11
lines changed

Directory.Build.props

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<ImplicitUsings>true</ImplicitUsings>
2121
<Nullable>enable</Nullable>
2222
</PropertyGroup>
23+
2324
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
2425
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
2526
</PropertyGroup>

Directory.Packages.props

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
99
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
1010
<PackageVersion Include="Moq" Version="4.20.69" />
11-
<PackageVersion Include="xunit" Version="2.7.1" />
12-
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.8" />
11+
<PackageVersion Include="xunit" Version="2.8.1" />
12+
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.1" />
1313
</ItemGroup>
1414
</Project>

IntelliTect.Multitool.Tests/Extensions/HttpExtensionsTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static HttpExtensionsTests()
1515
[InlineData("https://thisisaverybadurlthatwillnotworkhopefullyever.com/", false)]
1616
[InlineData("https://www.google.com/", true)]
1717
[InlineData("https://api.github.com/meta", true)]
18-
public async void ValidateUri_CheckUrl_SuccessIsAsExpected(string urlUnderTest, bool expected)
18+
public async Task ValidateUri_CheckUrl_SuccessIsAsExpected(string urlUnderTest, bool expected)
1919
{
2020
Assert.Equal(expected, await HttpClient.ValidateUri(new Uri(urlUnderTest), new System.Net.Http.Headers.ProductInfoHeaderValue(new System.Net.Http.Headers.ProductHeaderValue("IntelliTect.Multitool.Testing"))));
2121
}

IntelliTect.Multitool.Tests/IntelliTect.Multitool.Tests.csproj

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<Import Project="../IntelliTect.Multitool/Build/IntelliTect.Multitool.targets" />
33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1; net6.0; net8.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0</TargetFrameworks>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

9+
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' != 'true'">
10+
<!-- We want to make sure our CI property works properly on the runner, this is just to run tests locally -->
11+
<!-- We don't use the $CI condition since that is the one under test -->
12+
<ReleaseDateAttribute>true</ReleaseDateAttribute>
13+
</PropertyGroup>
14+
915
<ItemGroup>
1016
<PackageReference Include="Moq" />
1117
<PackageReference Include="Microsoft.NET.Test.Sdk" />
@@ -20,4 +26,4 @@
2026
<ItemGroup>
2127
<ProjectReference Include="..\IntelliTect.Multitool\IntelliTect.Multitool.csproj" />
2228
</ItemGroup>
23-
</Project>
29+
</Project>

IntelliTect.Multitool.sln

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.Multitool.Tests
88
EndProject
99
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7FB66610-EB11-460E-8CC8-F49044F452D0}"
1010
ProjectSection(SolutionItems) = preProject
11-
appveyor.yml = appveyor.yml
1211
.github\workflows\build-and-test.yml = .github\workflows\build-and-test.yml
1312
.github\workflows\deploy.yml = .github\workflows\deploy.yml
1413
Directory.Build.props = Directory.Build.props

IntelliTect.Multitool/Build/IntelliTect.Multitool.targets

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
<Project>
2-
<ItemGroup>
3-
<AssemblyAttribute Include="IntelliTect.Multitool.ReleaseDate">
4-
<_Parameter1>$([System.DateTime]::UtcNow.ToString("O"))</_Parameter1>
5-
</AssemblyAttribute>
6-
</ItemGroup>
2+
<ItemGroup>
3+
<AssemblyAttribute Condition="'$(CI)' == 'true' OR '$(ReleaseDateAttribute)' == 'true'" Include="IntelliTect.Multitool.ReleaseDate">
4+
<_Parameter1>$([System.DateTime]::UtcNow.ToString("O"))</_Parameter1>
5+
</AssemblyAttribute>
6+
</ItemGroup>
7+
8+
<PropertyGroup Label="CI" Condition="'$(CI)' == ''">
9+
<CI>false</CI>
10+
<!-- GH, CircleCI, GitLab and BitBucket already use CI -->
11+
<CI Condition="'$(TF_BUILD)' == 'true' or
12+
'$(TEAMCITY_VERSION)' != '' or
13+
'$(APPVEYOR)' != '' or
14+
'$(BuildRunner)' == 'MyGet' or
15+
'$(JENKINS_URL)' != '' or
16+
'$(TRAVIS)' == 'true' or
17+
'$(BUDDY)' == 'true' or
18+
'$(CODEBUILD_CI)' == 'true'">true</CI>
19+
</PropertyGroup>
720

821
<Target Name="WriteLaunchers" AfterTargets="CopyFilesToOutputDirectory">
922
<PropertyGroup>

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
// Result is "Build: 8 Feb, 2023 11:36:31 AM"
3838
```
3939

40+
### Miscellaneous Information:
41+
42+
- To help [hot reload in visual studio work properly](https://github.com/IntelliTect/Multitool/issues/125), the release date attribute will be automatically be generated during compilation on a CI runner, but it won’t generate locally by default. If you want it to generate locally, set the `ReleaseDateAttribute` to true within a property group in your project file. (`<ReleaseDateAttribute>true</ReleaseDateAttribute>`)
43+
4044
## RepositoryPaths - Provides consistent environment-independent normalized pathing within a git repository
4145

4246
### Samples:

0 commit comments

Comments
 (0)