Gorgo.Live.ToString()

Mariusz, Gorzoch tech Blog

Stsdev bug – unexpected error has occure

leave a comment »

Today I’ve created a new project for simple feature with use of stsdev tool. Creation went smoth without any problem. Then I open the visual studio 2008, added my project to the solution (as it was new project for bigger solution), did some codding and finally went for hitting F5 for the first time. Guess what happend:
 
 
woow 😦
 
I started to dig and found that stsdev is rising exception:
 
Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path ‘C:\MyProj\Lawyers\DeploymentFiles\SolutionConfig.xml’.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamWriter.CreateFile(String path, Boolean append)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamWriter..ctor(String path)
   at stsdev.SolutionConfigBuilder.Create(String FilePath, Boolean AssemblyDeployment, Boolean SafeControlSettings, AssemblyDeploymentTarget DeploymentTarget, PermissionSet CasPermissions)
   at stsdev.SolutionConfigBuilder.Create(String FilePath, Boolean AssemblyDeployment, Boolean SafeControlSettings, AssemblyDeploymentTarget DeploymentTarget)
   at stsdev.SolutionConfigBuilder.Create(String FilePath, Boolean AssemblyDeployment, Boolean SafeControlSettings)
   at stsdev.SolutionConfigBuilder.Create(String FilePath, Boolean AssemblyDeployment)
   at stsdev.SolutionBuilder.LoadSolutionConfigFile()
   at stsdev.SolutionBuilder.RefreshDeploymentFiles()
   at stsdev.SolutionBuilder.RefreshDeploymentFiles(String TargetSolutionName, String TargetSolutionDirectory)
 
After digging for a while, I found reason of the problem. This was caused by the first line, when stsdev is call with parameter "‘C:\MyProj\Lawyers\DeploymentFiles\SolutionConfig.xml’" which is wrong. I dig a little bit more and found that there is a problem with file "Microsoft.SharePoint.targets" located inside "DeploymentFiles" directory. This file is a configuration file for building your solution. If you open this file, you should find line like this one:
 

<REFRESH>$(STSDEV) /refresh "$(TargetName)" "$(SolutionDir)"</REFRESH>

Here is a small bug which you will see in case when your project is inside solution. In my case it is, so my "DeploymentFiles" directory can not be found by stsdev. To solve the problem you need to update above line to look like this:

<REFRESH>$(STSDEV) /refresh "$(TargetName)" "$(ProjectDir)"</REFRESH>

after that, just unload your project, go to explorer and remove "bin" and "obj" folder, reload project and try to build it. This time you should not get the error (at least I don’t)

 
Advertisements

Written by Mariusz Gorzoch

24 June 2009 at 15:02

Posted in SharePoint

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: