Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommendations for publishing the application #106

Closed
MrDave1999 opened this issue Jan 19, 2024 · 1 comment
Closed

Recommendations for publishing the application #106

MrDave1999 opened this issue Jan 19, 2024 · 1 comment
Labels
question Further information is requested

Comments

@MrDave1999
Copy link
Member

No description provided.

@MrDave1999 MrDave1999 added the question Further information is requested label Jan 19, 2024
@MrDave1999
Copy link
Member Author

MrDave1999 commented Jan 20, 2024

It is recommended to publish the application in a directory other than the project folder (where the project file is located).

Example:

dotnet publish -o /home/admin/out/PublishedApp -c Release

Why should you follow this recommendation?

The library may fail intentionally through a developer error.

For example, imagine that the project structure of a developer is:

└── ConsoleApp/
    ├── Reports/
    │   ├── products.sql
    │   └── orders.sql
    ├── ConsoleApp.csproj
    └── Program.cs

A developer can execute the following command:

dotnet publish -o MyOutput -c Release

A directory called MyOutput is created in /ConsoleApp and this directory will have a yesql folder with the SQL files.
A bin folder is also created with the yesql folder.

└── ConsoleApp/
    ├── bin/Release/net8.0/
    │   └── yesql/
    │       └── Reports/
    │           ├── products.sql
    │           └── orders.sql
    ├── Reports/
    │   ├── products.sql
    │   └── orders.sql
    ├── MyOutput/
    │   ├── yesql/
    │   │   └── Reports/
    │   │       ├── products.sql
    │   │       └── orders.sql
    │   ├── ConsoleApp.dll
    │   ├── ConsoleApp.exe
    │   └── ConsoleApp.pdb
    ├── ConsoleApp.csproj
    └── Program.cs

When the developer executes the dotnet build -c Release command, the MyOutput folder will also be copied to bin/Release/net8.0/yesql.

└── ConsoleApp/
    ├── bin/Release/net8.0/
    │   └── yesql/
    │       ├── Reports/
    │       │   ├── products.sql
    │       │   └── orders.sql
    │       └── MyOutput/
    │           └── yesql/
    │               └── Reports/
    │                   ├── products.sql
    │                   └── orders.sql
    ├── Reports/
    │   ├── products.sql
    │   └── orders.sql
    ├── MyOutput/
    │   ├── yesql/
    │   │   └── Reports/
    │   │       ├── products.sql
    │   │       └── orders.sql
    │   ├── ConsoleApp.dll
    │   ├── ConsoleApp.exe
    │   └── ConsoleApp.pdb
    ├── ConsoleApp.csproj
    └── Program.cs

This is normal behavior, it cannot be avoided, however, this causes the library to load the same SQL files, so it leads to an exception for having duplicate tags. This exception occurs when using this method: YeSqlLoader.LoadFromDefaultDirectory (this loads the SQL statements from a default directory called yesql).

The one that is recommended is not to create the publish directory inside the project folder, after all git would track the changes and it should not be like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant