Publish the application
Visual Studio publish produces a folder you copy to IIS. Damsy ERP uses a dedicated profile MVC_PUBLISH tuned for VPS deployment: Release configuration, full view files (no precompile), and a clean output directory each time.
Introduction
Publishing compiles the solution in Release mode, applies Web.Release.config transforms, and copies web content to a target folder. Unlike SDK-style projects, classic ASP.NET MVC requires explicit <Content Include="..."> entries in the .csproj for many static files and views — files missing from the project file are silently omitted from publish output.
Purpose
Generate a complete, IIS-ready folder that includes assemblies, Razor views, CSS/JS, Crystal viewer assets, and transformed configuration — without the broken partial deployments that precompiled publish often causes.
When to use
- Every production or VPS deployment
- Before copying files to
C:\inetpub\wwwroot\damsy_erp - After adding new
.cshtml,.css, or.jsfiles to the UI project
For IIS binding and app pool setup, continue to Deploy to IIS.
How it works
The publish profile lives at:
DamsyERP.UI/Properties/PublishProfiles/MVC_PUBLISH.pubxml
Key settings:
| Setting | Value | Why |
|---|---|---|
LastUsedBuildConfiguration | Release | Optimized binaries + transforms |
WebPublishMethod | FileSystem | Folder copy deploy |
DeleteExistingFiles | True | Avoid stale DLLs and orphaned views |
PrecompileBeforePublish | False | Precompile breaks views/assets on IIS |
publishUrl | Dev machine path | Change or override per operator |
Example profile output path:
C:\Users\Thinkpad\Music\Publish\damsy_erp
Production IIS target (typical):
C:\inetpub\wwwroot\damsy_erp
Step-by-step — Publish from Visual Studio
Step 1 — Open the publish profile
- Set configuration to Release (toolbar dropdown).
- Right-click
DamsyERP.UI→ Publish. - Select profile
MVC_PUBLISH(or import the.pubxmlfromProperties/PublishProfiles/).
Step 2 — Run publish
- Confirm Configuration: Release.
- Click Publish.
- Wait for Publish succeeded in the Output window.
PrecompileBeforePublish=False is intentional. Precompiled publish has caused missing partial views and static asset issues on IIS for this solution.
Step 3 — Verify the publish folder
Before copying to the server, confirm critical paths exist:
publish/damsy_erp/
├── bin/DamsyERP.UI.dll
├── Web.config
├── Views/Dashboard/Index.cshtml
├── Areas/Registration/Views/Shared/_UnitPermissionS.cshtml
├── app-assets/css/shell-modern.css
├── app-assets/css/sidebar-unified.css
├── app-assets/css/administration-dashboard.css
└── crystalreportviewers13/
Use Windows Search or PowerShell:
Test-Path "C:\Users\Thinkpad\Music\Publish\damsy_erp\app-assets\css\shell-modern.css"
Step 4 — Copy to IIS
Copy the entire folder contents to Deploy to IIS target path, then recycle the app pool.
The csproj Content Include gotcha
New files added to disk are not automatically published. They must appear in DamsyERP.UI.csproj:
<Content Include="app-assets\css\shell-modern.css" />
<Content Include="Areas\Registration\Views\Shared\_UnitPermissionS.cshtml" />
Symptoms of missing includes
| Missing file type | Symptom |
|---|---|
| Module CSS | Dashboard looks unstyled; "old" flat UI |
| Shared partial | The partial view '_UnitPermissionS' was not found |
| Area view | 404 or HandleError after navigation |
Fix workflow
- In Solution Explorer, Show All Files.
- Right-click the missing file → Include in Project (adds Content entry).
- Rebuild and Publish again.
- Re-verify the publish folder before IIS copy.
A successful publish dialog does not guarantee every file on disk was included. Always spot-check new assets in the output folder.
Examples
Example — Publish via MSBuild (CI or script)
msbuild DamsyERP.UI\DamsyERP.UI.csproj `
/p:DeployOnBuild=true `
/p:PublishProfile=MVC_PUBLISH `
/p:Configuration=Release
Example — Quick CSS audit after publish
$root = "C:\Users\Thinkpad\Music\Publish\damsy_erp\app-assets\css"
Get-ChildItem $root -Filter "*dashboard*.css" | Select-Object Name
Example — Adding a new stylesheet
- Add
app-assets/css/payroll-dashboard-v2.csson disk. - Include in
.csprojas<Content Include="app-assets\css\payroll-dashboard-v2.css" />. - Reference in layout with cache-bust query:
?v=20250720. - Publish and confirm file under publish root.
Related pages
Important notes
DeleteExistingFiles=Trueremoves leftover files from prior deploys — good for consistency; ensure you do not store uploads only under the publish tree without backup.- Connection strings on the server should be edited in the deployed
Web.config, not only in source control. - Crystal Reports
.rptfiles and viewer JS must publish with the site; verify underAreas/*/...Reports/andcrystalreportviewers13/. - Layouts use cache-busting query strings on CSS — browsers may still cache aggressively; hard-refresh after deploy.
Common mistakes
| Mistake | Consequence |
|---|---|
| Publishing with Debug configuration | No Release transforms; debug=true |
| Using a profile with PrecompileBeforePublish=True | Broken or missing views on IIS |
| Assuming git pull updates IIS | Must publish + copy + recycle |
Forgetting .csproj include for new .cshtml | Runtime partial/view not found |
| Copying only changed DLLs | Stale views/CSS remain or mismatch |
Next steps
- Apply Release configuration expectations on the server.
- Deploy to IIS and grant
IIS APPPOOL\...SQL access. - Log in against a configured database — Seed scripts.