I cannot believe that I am the first person ever to encounter the following error:
MSB3095: Invalid argument. Illegal characters in path.

[Update] As Tom pointed out in the comments, this issue is directly related to the encoding of my *.refresh file.  Thanks Tom.

I searched Google and other search engines with no success.  I found "MSB3095: Invalid Argument", and I found "Illegal characters in path.", but never in the same place.

I did not actually resolve the issue; I was able to work around it.  I have a website project that references some local projects as well as a couple of third party libraries.  I use *.refresh files to guarantee I get the latest version of the libraries from my dependencies folder.

Recently, I put together a library of extension methods and added it to my dependencies folder.  I added a new *.refresh file to my website.  Everything compiles fine on my desktop.  When I committed the changes, the build server responded with the MSB3095 error and failed compilation.

I remembered that I am using the extensions library in other projects with a direct reference.  It turns out I didn't need the *.refresh file at all.  The reference to my new library was inferred.

After removing the *.refresh file, the build server compiled the website without issue.

I still feel a little uncertain about this resolution.  I am using other refresh files.  What was wrong with this one?  I checked the path inside it and there was no problem with it.  The only thing I can imagine (though I have not tested) is that it may have something to do with my library having extra dots (.) in the name.  e.g.  MyCompany.Extensions.dll.refresh

If I discover something new I will update this post.

posted on Tuesday, May 20, 2008 8:08 AM
Filed Under [ Builds & CI .Net MSBuild ]


# re: MSBuild error 3095
posted by Tom Kidd
on 10/21/2008 2:50 PM
I think I figured out what it might be.

I have a .NET 2.0 project and I experienced a similar issue where msbuild through Nant with a .refresh file I had added myself.

I'm not 100% sure of the particulars, but it seems that when Visual Studio (2008, in this case) adds the .refresh file, it adds it using a particular Unicode encoding. Whatever it is, TextPad (my text editor) discards it or doesn't save/update it properly.

You can tell if the encoding is wrong because Visual Studio will open it in a "hex" mode instead of "plain text"

Notepad, though, preserves whatever encoding it needs, so open a "generated" .refresh file, replace its contents with what you need, save it with the filename you want, and it should work.
# re: MSBuild error 3095
posted by Will
on 10/24/2008 7:59 AM
Indeed, Tom. I opened the file in visual studio to find it in hex mode. I change the encoding and everything worked fine.
# re: MSBuild error 3095
posted by Allen
on 8/3/2010 9:32 AM
Hey just letting you know that I ran into this as well and I'm surprised that there still aren't any google results on the topic. Anyway as the commenter said earlier, textpad was the problem. I opened every .refresh file in notepad and saved it and the project built fine!

Post A Comment