Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Watch with solution fails msbuild when involving a project with special character(s) #1438

Open
a-shoemaker opened this issue Aug 17, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@a-shoemaker
Copy link
Contributor

Describe the bug

msbuild error occurs when doing a --watch, with a solution file specified in the tye.yaml, upon making a subsequent change to a file in a project with a special character, such as a ..

System.ArgumentException: The name "XXX.yyy" contains an invalid character ".".

The special characters are to be replaced by an _ for the -targets argument (see https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-build-specific-targets-in-solutions-by-using-msbuild-exe?view=vs-2022), but are not.

Reference:
https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-build-specific-targets-in-solutions-by-using-msbuild-exe?view=vs-2022

To Reproduce

  • Specify a solution in your tye.yaml
  • Have a csproj project with a . (or other special character) in the name
  • Run tye run --watch
  • Modify a file within the project with the special character in order to trigger a build of that project
  • That command will error due to containing an invalid character (e.g., the .)

Example Logs:

[09:38:08 INF] Build Watcher: Building XXX.yyy of solution ../ZZZ.sln...
[09:38:08 INF] Build Watcher: Waiting for builds to complete...
[09:38:08 INF] Build Watcher: Solution build failed with exit code -532462766: 
MSBuild version 17.3.0+92e077650 for .NET
ZZZ.sln : error MSB4014: The build stopped unexpectedly because of an internal failure.
ZZZ.sln : error MSB4014: System.ArgumentException: The name "XXX.yyy" contains an invalid character ".".
...

Further technical details

Tye version: 0.11.0-alpha.22111.1+3edef5428949c518c078844d6438e5ba86fce600

Bug introduced here: I believe
https://github.com/dotnet/tye/pull/1189/files#diff-523fd91d9257dbd6f1858e24a1520bf3424c0d2f48b14a5de76d6439bbaa7866
(see line 217)

A special character is defined as %, $, @, ;, ., (, ), or '.
See: https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-build-specific-targets-in-solutions-by-using-msbuild-exe?view=vs-2022

A fix I believe should do a find/replace on these characters, replacing any of them with a _ (e.g., regex replace).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant