sourceName not replaced in Folder/File names in 2.0-preview2
See original GitHub issueWhen switching from dotnet SDK 1.4 to dotnet SDK 2.0 preview 2 I noticed a change in how dotnet templating works and I’d like to know if that’s expected (basically an intentional breaking change) or a bug.
With 1.4 if sourceName
was present in any folder or file name it would be replaced. SDK 2.0 preview 2 does not perform replacement in folder/file names.
For example, if the template.json contained sourceName: "HelloWorld"
and following folder structure
└───HelloWorld
│ dirs.proj
│ HelloWorld.sln
│ HelloWorld.v3.ncrunchsolution
│
├───HelloWorld
│ Hello.cs
│ HelloWorld.csproj
│ HelloWorld.v3.ncrunchproject
│ Initializer.cs
│
├───HelloWorld.Exports
│ HelloWorld.Exports.csproj
│ HelloWorld.Exports.v3.ncrunchproject
│ IHello.cs
│
├───HelloWorld.Extensions
│ HelloExtensions.cs
│ HelloWorld.Extensions.csproj
│ HelloWorld.Extensions.v3.ncrunchproject
│
└───HelloWorld.UnitTests
HelloWorld.UnitTests.csproj
HelloWorld.UnitTests.v3.ncrunchproject
HelloWorldTest.cs
after running dotnet new lib -n MyNewLibrary
with SDK 1.4 I get following template created:
└───MyNewLibrary
│ dirs.proj
│ MyNewLibrary.sln
│ MyNewLibrary.v3.ncrunchsolution
│
├───MyNewLibrary
│ Hello.cs
│ Initializer.cs
│ MyNewLibrary.csproj
│ MyNewLibrary.v3.ncrunchproject
│
├───MyNewLibrary.Exports
│ IHello.cs
│ MyNewLibrary.Exports.csproj
│ MyNewLibrary.Exports.v3.ncrunchproject
│
├───MyNewLibrary.Extensions
│ HelloExtensions.cs
│ MyNewLibrary.Extensions.csproj
│ MyNewLibrary.Extensions.v3.ncrunchproject
│
└───MyNewLibrary.UnitTests
MyNewLibrary.UnitTests.csproj
MyNewLibrary.UnitTests.v3.ncrunchproject
MyNewLibraryTest.cs
with the very same template and dotnet SDK 2.0 I’m getting following result:
├───HelloWorld
│ │ dirs.proj
│ │ HelloWorld.sln
│ │ HelloWorld.v3.ncrunchsolution
│ │
│ ├───HelloWorld
│ │ Hello.cs
│ │ HelloWorld.csproj
│ │ HelloWorld.v3.ncrunchproject
│ │ Initializer.cs
│ │
│ ├───HelloWorld.Exports
│ │ HelloWorld.Exports.csproj
│ │ HelloWorld.Exports.v3.ncrunchproject
│ │ IHello.cs
│ │
│ ├───HelloWorld.Extensions
│ │ HelloExtensions.cs
│ │ HelloWorld.Extensions.csproj
│ │ HelloWorld.Extensions.v3.ncrunchproject
│ │
│ └───HelloWorld.UnitTests
│ HelloWorld.UnitTests.csproj
│ HelloWorld.UnitTests.v3.ncrunchproject
│ HelloWorldTest.cs
cc: @rachit1503
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Dash `-` in `sourceName` gets changed to underscore `_` ...
The original sourceName gets replaced either with tst-tst or tst_tst everywhere, i.e. both in the source files (including the .sln ) and in...
Read more >Usability: Course Files management in 2.0
I get an error when I try to upload the new image (can't write to database). My guess is that it does not...
Read more >Including linked files from outside the project directory in ...
In this post I show how to include files in a project that are outside the project directory.
Read more >Newtonsoft Json package
Simply copy the package into your packages directory and replace the dll and the AOT dll. The link.xml file can also be modified...
Read more >android - The APK file does not exist on disk
Click this option to solve the error: Run: View > Tool Windows > Gradle > [project] > Tasks > build.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The template is distributed in an internal NuGet feed, so I can’t really move them under
./src/libs
. But the real workaround is to use 1.4 and not preview builds 😃@MarcinJuraszek - the fix for this issue is available in the newest dotnet/cli release-2.0.0 daily build, it’s version 2.0.1-servicing-006933. You can download it here: https://github.com/dotnet/cli/tree/release/2.0.0
Please let us know if you’re still encountering problems.