xcopy /y $(ProjectDir)$(OutDir)..\..\csharpblogtracker\Scripts\csharpcomm.js $(ProjectDir)$(OutDir)..\ScriptsThat's it... now compile your deployment project and you should find csharpcomm.js copied. Same procedure can be used for pages, user controls, resource files etc.. But correct method is to create a common assembly and add reference to this common library. “We have to stop optimizing for programmers and start optimizing for users.” – Jeff Atwood
public string aboutme {
var known = { { "C#" , "Javascript" }, { "ASP.NET", "MVC" } };
return known.ToJson();
}
Tuesday, 20 November 2012
Unable to share user controls as a link between projects in ASP.NET
Sharing user control as a link between project is not advisable as per microsoft article How to: Add Existing Items to a Project. Look at note under "Adding an Existing Item as a Link" as it says
"Visual Basic Web projects, Visual C# Web projects, and other similar projects do not support links to items."
But if you still want to go with this method, then here it is how you can achieve it. Consider you have following projects in your solution
- Web application 1 => csharpbloggerapp.csproj
- Web application 2 => csharpblogtracker.csproj
- a deployment project for web app csharpbloggerapp.deploy.csproj (for csharpbloggerapp.csproj)
Now consider you have a script csharpcomm.js inside csharpblogtracker.csproj under script folder and would like to include this into csharpbloggerapp.csproj not as another file but as a link, so making changes/fixes/enhancements will be easy.
1. First go to "scripts" folder inside csharpbloggerapp.csproj, then right click on "Scripts" folder select "Add Existing Item" , browse to csharpblogtracker->scripts and select the file csharpcomm.js
2. Now from the Open button drop-down list, select Add As Link
After adding the link, compile your deploy project and you shall notice "csharpcomm.js" has not been copied.
3. Now add a "Post Build Event" for csharpbloggerapp.csproj as follows
Subscribe to:
Post Comments (Atom)
Great Article
ReplyDeleteASP.NET MVC Training
Online MVC Training
Online MVC Training India
Dot Net Training in Chennai
.Net Online Training
.net training online
Dot Net Online Training
C# Training