Skip to content

Commit 7bef883

Browse files
committed
dotnet build ignores --framework
1 parent 34b9844 commit 7bef883

File tree

9 files changed

+78
-64
lines changed

9 files changed

+78
-64
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
4+
<TargetFrameworks>net10.0</TargetFrameworks>
55
</PropertyGroup>
66

77
</Project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net8.0</TargetFrameworks>
5+
</PropertyGroup>
6+
7+
</Project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net9.0</TargetFrameworks>
5+
</PropertyGroup>
6+
7+
</Project>

tests/ClassLibrary/ClassLibrary.sln

Lines changed: 0 additions & 25 deletions
This file was deleted.

tests/Test/Test.csproj renamed to tests/Test/Test-net10.0.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
5+
<TargetFrameworks>net10.0</TargetFrameworks>
66
</PropertyGroup>
77

88
</Project>

tests/Test/Test-net8.0.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFrameworks>net8.0</TargetFrameworks>
6+
</PropertyGroup>
7+
8+
</Project>

tests/Test/Test-net9.0.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFrameworks>net9.0</TargetFrameworks>
6+
</PropertyGroup>
7+
8+
</Project>

tests/Test/Test.sln

Lines changed: 0 additions & 25 deletions
This file was deleted.

tests/common.rs

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,22 @@ pub fn test_netcore_version() -> String {
1313
env::var("NETCOREHOST_TEST_NETCORE_VERSION").unwrap_or_else(|_| "net8.0".to_string())
1414
}
1515

16+
pub fn test_project_file_path() -> PathBuf {
17+
PathBuf::from_str(&format!(
18+
"tests/Test/Test-{}.csproj",
19+
test_netcore_version()
20+
))
21+
.unwrap()
22+
.absolutize()
23+
.unwrap()
24+
.to_path_buf()
25+
}
26+
1627
pub fn test_runtime_config_path() -> PdCString {
1728
PdCString::from_os_str(
1829
PathBuf::from_str(&format!(
19-
"tests/Test/bin/Debug/{}/Test.runtimeconfig.json",
30+
"tests/Test/bin/Debug/{}/Test-{}.runtimeconfig.json",
31+
test_netcore_version(),
2032
test_netcore_version()
2133
))
2234
.unwrap()
@@ -30,7 +42,8 @@ pub fn test_runtime_config_path() -> PdCString {
3042
pub fn test_dll_path() -> PdCString {
3143
PdCString::from_os_str(
3244
PathBuf::from_str(&format!(
33-
"tests/Test/bin/Debug/{}/Test.dll",
45+
"tests/Test/bin/Debug/{}/Test-{}.dll",
46+
test_netcore_version(),
3447
test_netcore_version()
3548
))
3649
.unwrap()
@@ -41,10 +54,22 @@ pub fn test_dll_path() -> PdCString {
4154
.unwrap()
4255
}
4356

44-
pub fn library_dll_path() -> PdCString {
57+
pub fn library_project_file_path() -> PathBuf {
58+
PathBuf::from_str(&format!(
59+
"tests/ClassLibrary/ClassLibrary-{}.csproj",
60+
test_netcore_version()
61+
))
62+
.unwrap()
63+
.absolutize()
64+
.unwrap()
65+
.to_path_buf()
66+
}
67+
68+
pub fn library_symbols_path() -> PdCString {
4569
PdCString::from_os_str(
4670
PathBuf::from_str(&format!(
47-
"tests/ClassLibrary/bin/Debug/{}/ClassLibrary.dll",
71+
"tests/ClassLibrary/bin/Debug/{}/ClassLibrary-{}.pdb",
72+
test_netcore_version(),
4873
test_netcore_version()
4974
))
5075
.unwrap()
@@ -55,10 +80,11 @@ pub fn library_dll_path() -> PdCString {
5580
.unwrap()
5681
}
5782

58-
pub fn library_symbols_path() -> PdCString {
83+
pub fn library_dll_path() -> PdCString {
5984
PdCString::from_os_str(
6085
PathBuf::from_str(&format!(
61-
"tests/ClassLibrary/bin/Debug/{}/ClassLibrary.pdb",
86+
"tests/ClassLibrary/bin/Debug/{}/ClassLibrary-{}.dll",
87+
test_netcore_version(),
6288
test_netcore_version()
6389
))
6490
.unwrap()
@@ -79,12 +105,16 @@ pub fn build_test_project() {
79105
return;
80106
}
81107

108+
let netcore_version = test_netcore_version();
109+
let project_file_path = test_project_file_path();
110+
let project_dir = project_file_path.parent().unwrap();
111+
82112
Command::new("dotnet")
83113
.arg("build")
84-
.arg("Test.sln")
114+
.arg(&project_file_path)
85115
.arg("--framework")
86-
.arg(&test_netcore_version())
87-
.current_dir("tests/Test")
116+
.arg(netcore_version)
117+
.current_dir(project_dir)
88118
.spawn()
89119
.expect("dotnet build failed")
90120
.wait()
@@ -96,12 +126,16 @@ pub fn build_library_project() {
96126
return;
97127
}
98128

129+
let netcore_version = test_netcore_version();
130+
let project_file_path = library_project_file_path();
131+
let project_dir = project_file_path.parent().unwrap();
132+
99133
Command::new("dotnet")
100134
.arg("build")
101-
.arg("ClassLibrary.sln")
135+
.arg(&project_file_path)
102136
.arg("--framework")
103-
.arg(&test_netcore_version())
104-
.current_dir("tests/ClassLibrary")
137+
.arg(netcore_version)
138+
.current_dir(project_dir)
105139
.spawn()
106140
.expect("dotnet build failed")
107141
.wait()

0 commit comments

Comments
 (0)