0

I have tried to google the basic concept of deploying webpart, I am confused.

I have read that if we deploy through Visual Studio we are deploying it globally. I'm probably wrong on this info.

But if we deploy through Visual Studio, we can still specify the web application port. This is the same as if we deployed it through Powershell.

Now I have created a webpart, deployed it through powershell (Add-SpSolution -LiteralPath "path").

I have got it working and styled it with CSS. After that I change the code in Visual Studio and I deploy it again, through Visual Studio (right-clicking on the solution and picking deploy). Now when I change my css file through SP Designer, nothing changes /updates on the page.

Am I doing something wrong?

1 Answer 1

0

not doing anything wrong! its the browser that is cashing the older version of CSS. To get around this and to tell the browser to update the CSS file you add versioning to the link:

say in asp.net i have the following css:

<link href="/_layouts/WebParts/style.css" rel="stylesheet" type="text/css" />

i make changes but nothing is updated so I would add "?v=" at the end of the url for versioning.... so 1 would be ?v=1.

 <link href="/_layouts/WebParts/style.css?v=1" rel="stylesheet" type="text/css" />

then make some more changes and i would do the next version:

 <link href="/_layouts/WebParts/style.css?v=2" rel="stylesheet" type="text/css" />

you can even do 1.1 or 1.1.1 but it would get confusing.

same principle applies to JavaScript references.

been asked here but same as my answer:

https://stackoverflow.com/questions/7671168/why-adding-version-number-to-css-file-path

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.