Skip to content

Instantly share code, notes, and snippets.

@Vinaum8
Last active November 1, 2024 11:51
Show Gist options
  • Select an option

  • Save Vinaum8/af04f817767f0f7ef51c8300a3a06468 to your computer and use it in GitHub Desktop.

Select an option

Save Vinaum8/af04f817767f0f7ef51c8300a3a06468 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Script to analyze and prepare a .NET project for upgrade
# This script uses the .NET Upgrade Assistant to analyze the project,
# create necessary directories, and move files to appropriate locations.
# Run this script from the root of your solution directory.
# Reference: https://dotnet.microsoft.com/en-us/platform/upgrade-assistant
# Define the target framework version
target_framework="8.0"
# Privacy mode specifying how much data is included in generated report files (Unrestricted, Protected, Restricted)
privacy_mode="Protected"
# Analyze the solution for upgrade requirements and generate an HTML report
upgrade-assistant analyze --serializer HTML -r HTML --code --binaries --privacyMode "$privacy_mode" .
# Change directory to the HTML output directory
cd HTML/
# Create directories for static assets if they don't already exist
mkdir -p static/js/
mkdir -p static/css/
# Rename all .js files, converting backslashes to forward slashes
for file in "$base_name"*.js; do
new_file=$(echo "$file" | sed 's|\\|/|g' | sed 's|^/||')
mv "$file" "$new_file"
done
# Move the CSS file from its original location to the new static/css directory
mv \\static\\css\\style.css static/css/style.css
# Rename any remaining files that start with a backslash to remove the backslash
for file in \\*; do mv "$file" "${file#\\}"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment