Using post sharp with web projects?
25 posts • Page 3 of 3 • 1, 2, 3
Re: Using post sharp with web projects?
I was pulled away briefly from the tracing aspect of my project, but am finally able to try out what you posted.
I downloaded the code with SVN and built the project. I have a directory
C:\Program Files\PostSharp 1.0\ASP.Net Test\PostSharp.AspNet\bin\Debug
that contains PostSharp.AspNet.dll and its corresponding pdb file.
I opened the test website (PostSharp.AspNet.Test) in VS2005 and changed the following in web.config:
Could not load file or assembly 'PostSharp.AspNet' or one of its dependencies. The system cannot find the file specified. C:\Program Files\PostSharp 1.0\ASP.Net Test\PostSharp.AspNet.Test\Web.config 31
(where line 31 contains the assemblyPostProcessorType declaration).
Any thoughts?
Thank you,
Louis
I downloaded the code with SVN and built the project. I have a directory
C:\Program Files\PostSharp 1.0\ASP.Net Test\PostSharp.AspNet\bin\Debug
that contains PostSharp.AspNet.dll and its corresponding pdb file.
I opened the test website (PostSharp.AspNet.Test) in VS2005 and changed the following in web.config:
- <postsharp directory="C:\Program Files\PostSharp 1.0\ASP.Net Test\PostSharp.AspNet\bin\Debug" trace="true">
- <add name="laos-weaver" value="C:\Program Files\PostSharp 1.0"/>
- (replaced ISymWrapper reference with)
<add assembly="PostSharp.Laos, Version=1.0.8.316, Culture=neutral, PublicKeyToken=B13FD38B8F9C99D7"/>
<add assembly="PostSharp.Public, Version=1.0.8.316, Culture=neutral, PublicKeyToken=B13FD38B8F9C99D7"/>
Could not load file or assembly 'PostSharp.AspNet' or one of its dependencies. The system cannot find the file specified. C:\Program Files\PostSharp 1.0\ASP.Net Test\PostSharp.AspNet.Test\Web.config 31
(where line 31 contains the assemblyPostProcessorType declaration).
Any thoughts?
Thank you,
Louis
- louis210
- Posts: 6
- Joined: Tue Feb 26, 2008 9:55 pm
- Full Name: Louis
Re: Using post sharp with web projects?
First, you should use:
That is, give the directory containing the file postsharp.exe.
Then (and this is your current problem), you should copy PostSharp.AspNet.dll to the "bin" folder of your web app.
The line
I hope this helped,
Gael
- Code: Select all
<postsharp directory="C:\Program Files\PostSharp 1.0" trace="true">
...
That is, give the directory containing the file postsharp.exe.
Then (and this is your current problem), you should copy PostSharp.AspNet.dll to the "bin" folder of your web app.
The line
- Code: Select all
<add name="laos-weaver" value="C:\Program Files\PostSharp 1.0"/>
I hope this helped,
Gael
Gael Fraiteur, project leader
got good support? consider donating to the project.
got good support? consider donating to the project.
- gfraiteur
- Site Admin
- Posts: 674
- Joined: Tue Dec 18, 2007 3:09 pm
- Full Name: Gael Fraiteur
- Company: postsharp.org
Re: Using post sharp with web projects?
Fantastic! It looks to be working very well.
Thank you for all your help.
Thank you for all your help.
- louis210
- Posts: 6
- Joined: Tue Feb 26, 2008 9:55 pm
- Full Name: Louis
Re: Using post sharp with web projects?
In case anyone is interested in a manual (command-line) process, here is one approach:
In VS2005:
At the command line:
If you want to PostSharp a single file, just use PSHelper by itself and just specify the path to the file to be processed.
Enjoy!
Louis
In VS2005:
- Right-click on your website project (e.g. http://localhost/myproject) and choose "Publish Web Site"
- Uncheck "Allow this precompiled site to be updatable"
- Check "Use fixed naming and single page assemblies"
- Note the Target Location (e.g C:\Dev\MyProject\Compiled).
- Click ok to publish the website to that directory.
At the command line:
- Create a batch file called PSHelper.cmd one level above the Target Location (in this example, C:\Dev\MyProject) and add the following code. Set the local environment variables as you choose.
- Code: Select all
@echo off
setlocal
set PostSharp="C:\Program Files\PostSharp 1.0\PostSharp.exe"
set DefaultProj="C:\Program Files\PostSharp 1.0\Default.psproj"
set OutputFile="C:\Temp\PostSharpOutput.txt"
set TempDir=C:\Temp\PostSharp\
set DefaultParms=/SkipAutoUpdate /P:IntermediateDirectory=%TempDir% /P:CleanIntermediate=False /P:SignAssembly=False /P:PrivateKeyLocation=.
echo Processing "%~1".
echo. >> %OutputFile%
echo Processing "%~1". >> %OutputFile%
echo. >> %OutputFile%
%PostSharp% %DefaultProj% "%~1" /P:Output="%~2" /P:SearchPath=. %DefaultParms% >> %OutputFile%
mv "%~2" "%~1" /Y
- Create another batch file called PS.cmd at the same level as PSHelper and add the following code to it:
- Code: Select all
@echo off
setlocal
set OutputFile="C:\Temp\PostSharpOutput.txt"
echo Beginning PostSharp processing. > %OutputFile%
if not exist "Compiled\bin\App_Code.dll" goto ProcessPageDLLs
:ProcessApp_CodeDLL
echo.
echo ** App_Code DLL:
echo.
call PSHelper "Compiled\bin\App_Code.dll" "Compiled\bin\App_Code.dll.ps.dll"
:ProcessPageDLLs
echo.
echo ** Page-specific DLLs:
echo.
for %%x in (Compiled\bin\*.aspx.*.dll) do @call PSHelper "%%x" "%%x.ps.dll"
echo. >> %OutputFile%
echo PostSharp processing complete. >> %OutputFile%
:ViewResults
%OutputFile%
:End
echo.
pause
echo.
- Run PS.cmd. It will process all the DLLs and log its output to C:\Temp\PostSharpOutput.txt.
If you want to PostSharp a single file, just use PSHelper by itself and just specify the path to the file to be processed.
Enjoy!
Louis
- louis210
- Posts: 6
- Joined: Tue Feb 26, 2008 9:55 pm
- Full Name: Louis
Re: Using post sharp with web projects?
Thank you!
Gael Fraiteur, project leader
got good support? consider donating to the project.
got good support? consider donating to the project.
- gfraiteur
- Site Admin
- Posts: 674
- Joined: Tue Dec 18, 2007 3:09 pm
- Full Name: Gael Fraiteur
- Company: postsharp.org
25 posts • Page 3 of 3 • 1, 2, 3