Reputation:
I have a c# web application project in Visual Studio 2008 that I want to precompile for deployment. After looking at various options, it seems all of them have some issues - perhaps someone could give their thoughts on this:
The project is under source control and also contains a lot of files that are excluded from project.
Web Deployment Projects does not work. If I try to use a wdp to compile, aspnet_compiler.exe will also try to compile all the excluded files. I don't want to maintain an exclude list in the msbuild script.
Is there a way to tell msbuild only to use the files/items that are specified in the csproj file, copy these to an intermediate folder and have aspnet_complier.exe build from this copy that does not contain any of the excluded files?
The website has depencies to 3 other csproj files.
Thanks!
Upvotes: 2
Views: 3243
Reputation: 5331
You can make msbuild tasks to hide (attrib +h) or delete unwanted files...
<PropertyGroup>
<MyLogFile>kaantologi.txt</MyLogFile>
<MyWebSourcePath>c:\sourecontrol\myweb</MyWebSourcePath>
<!-- *.tmp and .exclude and etc: -->
<MyCleaup>
attrib $(MyWebSourcePath)\*.tmp -r -s -h -a /s >>$(MyLogFile)
del $(MyWebSourcePath)\*.tmp /q /s >>$(MyLogFile)
attrib $(MyWebSourcePath)\*.exclude +h
</MyCleaup>
</PropertyGroup>
<Target Name="MyClean">
<Exec Command="$(MyCleaup)" />
</Target>
<Target Name="MyFinal">
<Exec Command="attrib $(MyWebSourcePath)\*.exclude -h"/>
</Target>
<Target Name="MyBuild">
<CallTarget Targets="MyClean" />
<CallTarget Targets="MyCompile" /><!--...-->
<CallTarget Targets="MyFinal" />
</Target>
Or you can use a solution file (.sln) and have your csproj there and build that.
Ps. Not exactly your problem, but this might help (it is for web sites, not for web applications):
Unable to publish using msbuild or aspnet_compiler using cc.net
Upvotes: 1
Reputation: 39287
Any reason you can't run aspnet_compiler.exe as part of your deployment script instead?
Why are the files there if they aren't used?
Suggestion: Run the compiler on deployment or remove the files
Upvotes: 0