Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ff45d4b

Browse files
atifazizshawncal
andauthoredSep 15, 2023
.Net: Fix build batch to align with Bash script (microsoft#2813)
### Motivation and Context **Why is this change required? What problem does it solve?** Consistent developer experience across platforms. **What scenario does it contribute to?** Developing the .NET solution on Windows. ### Description Steps to reproduce (assuming a Windows host and `main` being at f159a0d, which was the case at the time of opening this PR): git clone https://github.com/microsoft/semantic-kernel.git cd semantic-kernel git checkout f159a0d .\dotnet\build.cmd Expected the build to succeed, but instead the output is: MSBuild version 17.7.3+8ec440e68 for .NET MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file. MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file. The PR fixes the problem by updating `build.cmd` to be consistent with `build.sh` in two ways: - The script changes the current directory to the .NET solution root - Tests are run via `build test` if the solution builds successfully via `dotnet build`. This is done via `&&`. The PR also updates `.gitattributes` to make sure that `*.cmd` files use the `CRLF`, as is conventional for EOL on Windows. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone 😄 ### Other Information `dotnet --info` says: .NET SDK: Version: 7.0.401 Commit: eb26aacfec Runtime Environment: OS Name: Windows OS Version: 10.0.22621 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.401\ Host: Version: 7.0.11 Architecture: x64 Commit: ecb34f85ec .NET SDKs installed: 3.1.426 [C:\Program Files\dotnet\sdk] 5.0.416 [C:\Program Files\dotnet\sdk] 6.0.414 [C:\Program Files\dotnet\sdk] 7.0.203 [C:\Program Files\dotnet\sdk] 7.0.401 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation] Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/download Co-authored-by: Shawn Callegari <[email protected]>
1 parent b87f44e commit ff45d4b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed
 

‎.gitattributes

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
* text=auto eol=lf working-tree-encoding=UTF-8
33

44
# Bash scripts
5-
*.sh text eol=lf
5+
*.sh text eol=lf
6+
*.cmd text eol=crlf

‎dotnet/build.cmd

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@echo off
2-
3-
dotnet build --configuration Release --interactive
4-
5-
dotnet test --configuration Release --no-build --no-restore --interactive
2+
setlocal
3+
cd "%~dp0"
4+
dotnet build --configuration Release --interactive ^
5+
&& dotnet test --configuration Release --no-build --no-restore --interactive

0 commit comments

Comments
 (0)
Please sign in to comment.