Rectangle 27 212

You can also use the Package Manager Console and invoke the Install-Package cmdlet by specifying the path to the directory that contains the package file in the -Source parameter:

Install-Package SomePackage -Source C:\PathToThePackageDir\

can i do something like that with the command line tool also?

-Source
nuget install SomePackage -Source C:\PathToThePackageDir

was a little quick, sorry. What i wanted was the other way around. I would love to use the nuget command line to install dlls into bin folder on a cms site. But i found out reading online that it cant install, only pull down the dlls.

You might need to specify the -IncludePrerelease flag as well. Otherwise, if the package version has a dash-suffix (e.g "-beta1"), Install-Package won't find it.

visual studio - How to install a Nuget Package .nupkg file locally? - ...

visual-studio nuget
Rectangle 27 143

You could open the SLN file in any text editor (Notepad, etc.) and simply change the project path there.

thanks for the response! That worked!!! :) I just edited the line: Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CCP Utility", "CCP Utility\CCP Utility.csproj", "{FE1F9ED8-F161-485F-B9E6-357852321137}"

It should be noted that this will remove your project from source control if it's under there previously

In addition, you need to update the .csproj file for all projects that refer to the project for which you changed folder name. .csproj files are also text files, so that is easily done.

@dougajmcdonald and passersby, I handled this by moving the project to a new directory using the source control program first.

Visual Studio - How to change project's folder name and solution name ...

visual-studio-2010 visual-studio visual-studio-2008
Rectangle 27 143

You could open the SLN file in any text editor (Notepad, etc.) and simply change the project path there.

thanks for the response! That worked!!! :) I just edited the line: Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CCP Utility", "CCP Utility\CCP Utility.csproj", "{FE1F9ED8-F161-485F-B9E6-357852321137}"

It should be noted that this will remove your project from source control if it's under there previously

In addition, you need to update the .csproj file for all projects that refer to the project for which you changed folder name. .csproj files are also text files, so that is easily done.

@dougajmcdonald and passersby, I handled this by moving the project to a new directory using the source control program first.

Visual Studio - How to change project's folder name and solution name ...

visual-studio-2010 visual-studio visual-studio-2008
Rectangle 27 7

Here is another (more complex) way of getting either the filename or extension, first use the rev command to invert the file path, cut from the first . and then invert the file path again, like this:

filename=`rev <<< "$1" | cut -d"." -f2- | rev`
fileext=`rev <<< "$1" | cut -d"." -f1 | rev`
<<<

They are called "Here Strings" (more info here), basically it takes the input as a string and feed it to your program as it was reading through stdin.

linux - Extract file basename without path and extension in bash - Sta...

linux bash unix filenames
Rectangle 27 7

Here is another (more complex) way of getting either the filename or extension, first use the rev command to invert the file path, cut from the first . and then invert the file path again, like this:

filename=`rev <<< "$1" | cut -d"." -f2- | rev`
fileext=`rev <<< "$1" | cut -d"." -f1 | rev`
<<<

They are called "Here Strings" (more info here), basically it takes the input as a string and feed it to your program as it was reading through stdin.

linux - Extract File Basename Without Path and Extension in Bash - Sta...

linux bash unix filenames
Rectangle 27 2

@andersjanmyr's Solution: you may press Alt+Enter to bring up the Properties Page for the unavailable project and set the "File Path" property there; since it is not available in the right-click_context-menu of the unavailable project (in VS2008).

How to rename a Project Folder from within Visual Studio? - Stack Over...

visual-studio folder projects-and-solutions
Rectangle 27 2

@andersjanmyr's Solution: you may press Alt+Enter to bring up the Properties Page for the unavailable project and set the "File Path" property there; since it is not available in the right-click_context-menu of the unavailable project (in VS2008).

How to rename a Project Folder from within Visual Studio? - Stack Over...

visual-studio folder projects-and-solutions
Rectangle 27 25

Add Microsoft Visual Studio 10.0\Common7\IDE to your path, and this issue will not exist any more. You will be able to build without running this silly batch file every time.

From the original question "I could solve the problem by adding "%VS10%\Common7\IDE" to my PATH, but for various reasons [...], I don't want to do that."

Michael, since it's the only way to solve the problem it's the only real answer. The vcvars32.bat file just does this for you.

visual studio - MS C++ 2010 and mspdb100.dll - Stack Overflow

visual-studio visual-studio-2010 visual-c++ dependencies dll
Rectangle 27 25

Add Microsoft Visual Studio 10.0\Common7\IDE to your path, and this issue will not exist any more. You will be able to build without running this silly batch file every time.

From the original question "I could solve the problem by adding "%VS10%\Common7\IDE" to my PATH, but for various reasons [...], I don't want to do that."

Michael, since it's the only way to solve the problem it's the only real answer. The vcvars32.bat file just does this for you.

visual studio - MS C++ 2010 and mspdb100.dll - Stack Overflow

visual-studio visual-studio-2010 visual-c++ dependencies dll
Rectangle 27 20

I had exactly the same issue but for a VS2010 Web Application project (with the Azure SDK 1.8 update to update the publishing options). It seemed as if the Web Publishing Targets provided by MS wouldnt evaluate the path for the Publish Profiles correctly.

My MSBuild command parameters looked as follows:

/P:DeployOnBuild=true /P:PublishProfile=[Name of My Profile (without a file extension)] /P:PublishProfileRootFolder="%teamcity.build.checkoutDir%\Source\Web Application\My Project\PublishProfiles" (where your publish profiles are stored) /P:AllowUntrustedCertificate=true /P:Password=%env.DomainPassword%

Hope this helps somebody in the same boat!

The /p:PublishProfileRootFolder fixed it for me, but without the quotes around the value.

YEEES!! OH DEAR GOD YES!! ...two weeks... "installing the Azure SDK (1.8) on the build server (Otherwise the publish profiles were ignored)" I upgraded me build server to 2008 R2 with MSBuild 12 and this stopped working. Every other solution was "stop using publish profiles, use command line properties" but that's just awful, I wanted them under source control. Thank god for +MattWoodward ...

Specifically I used this link: azure.microsoft.com/en-gb/downloads/archive-net-downloads We use VS 2012 and /p:VisualStudioVersion=11.0 so I downloaded the VS 2012 Link. I guess it fixed the v11 targets? Those links are WPI auto loaders that fire up WPI 5 and set it to install a specific set of files. Nice and automatic. To clarify, exact link/version was VS 2012 under the "2.6" heading, the latest version that included VS 2012 in it's list.

+RoboJ1M really glad I could help you out mate, it's a nightmare territory to be in when you're sorting out your builds with TC and things start going wrong!

visual studio - MsBuild not finding publish profile - Stack Overflow

visual-studio visual-studio-2012 msbuild teamcity
Rectangle 27 4

When Visual Studio compiles your project, it will be putting the output into the bin\debug directory. Any content files that you want to reference must also be copied to those locations, in order for your app residing in that directory to be able to read that file.

You have two choices:

  • either you set the Copy to Output Directory property on your FilterIwant.html to Copy if newer; in that case, if the file has changed, it will be copied to the output directory, and you should be able to reference it and load it there
  • you just define a path in your app.config, something like DataPath, and set it to your folder where the file resides. From your app, you then create the full path name for that file as Path.Combine(AppSettings["DataPath"], "FilterIwant.html") - with this approach, you become totally independant of where the file really is and you don't need to move around anything. Also: this gives you the opportunity to create an admin/config utility for your users later on, so that they can pick any directory they like, and your app will find those files there.

With the second method you basically have to set it up to the right path each time you deploy it correct?

@chobo2: you'd have to set it up once for each installation, yes. But having a config entry also gives you the ability to let the end user change that on their own, using e.g. a config utility. If you hardcode the behavior into your code, you don't have that possibility

.net - How to get a path from a directory in a C# console application?...

c# .net path relative-path
Rectangle 27 181

Getting some sort of modification date in a cross-platform way is easy - just call os.path.getmtime(path) and you'll get the Unix timestamp of when the file at path was last modified.

Getting file creation dates, on the other hand, is fiddly and platform-dependent, differing even between the three big OSes:

os.path.getctime()
.st_ctime
os.stat()
ctime
  • On Mac, as well as some other Unix-based OSes, you can use the .st_birthtime attribute of the result of a call to os.stat().

On Linux, this is currently impossible, at least without writing a C extension for Python. Although some file systems commonly used with Linux do store creation dates (for example, ext4 stores them in st_crtime) , the Linux kernel offers no way of accessing them; in particular, the structs it returns from stat() calls in C, as of the latest kernel version, don't contain any creation date fields. You can also see that the identifier st_crtime doesn't currently feature anywhere in the Python source. At least if you're on ext4, the data is attached to the inodes in the file system, but there's no convenient way of accessing it.

The next-best thing on Linux is to access the file's mtime, through either os.path.getmtime() or the .st_mtime attribute of an os.stat() result. This will give you the last time the file's content was modified, which may be adequate for some use cases.

import os
import platform

def creation_date(path_to_file):
    """
    Try to get the date that a file was created, falling back to when it was
    last modified if that isn't possible.
    See http://stackoverflow.com/a/39501288/1709587 for explanation.
    """
    if platform.system() == 'Windows':
        return os.path.getctime(path_to_file)
    else:
        stat = os.stat(path_to_file)
        try:
            return stat.st_birthtime
        except AttributeError:
            # We're probably on Linux. No easy way to get creation dates here,
            # so we'll settle for when its content was last modified.
            return stat.st_mtime

I've done my best to throw this together (and spent a few hours researching in the process), and I'm sure it's at least more correct than the answers that were here previously, but this is a really hard topic and I'd appreciate any corrections, clarifications, or other input that people can offer. In particular, I'd like to construct a way of accessing this data on ext4 drives under Linux, and I'd like to learn what happens when Linux reads files written by Windows, or vica versa, given that they use st_ctime differently.

Frankly, file creation time is usually fairly useless. When you open an existing file for write with mode "w", it's not replacing it, it just opens the existing file and truncates it. Even though the file contents are completely unrelated to whatever it had on creation, you'd still be told the file was "created" well before the current version. Conversely, editors that use atomic replace on save (original file is replaced by new work-in-progress temp file) would show a more recent creation date, even if you just deleted one character. Use the modification time, don't grub for creation time.

After many years, I've finally found a use for file creation time! I'm writing code to check a file naming convention in certain directories, so first of all I want to consider files that were first named after the convention was instituted. Replacing the entire contents (mtime) is irrelevant: if it was already there then it's grandfathered in.

Hi Mark. I propose a simplification. On Linux, returning stat.st_ctime is more pertinent because, in many cases, the time of last metadata change can be the creation time (at least ctime is closer to the real creation time than mtime). Therefore, you could simply replace your snippet by stat = os.stat(path_to_file); try: return stat.st_birthtime; except AttributeError: return stat.st_ctime. What do you think? Cheers

@olibre "at least ctime is closer to the real creation time than mtime" - no it isn't; this is something I've seen stated several times but it's totally false. Unless you've manually messed with the values in your inode, ctime should always be equal to or later than mtime, because an mtime change causes a ctime change (because the mtime itself is considered "metadata"). See stackoverflow.com/a/39521489/1709587 where I provide some example code to illustrate this.

How to get file creation & modification date/times in Python? - Stack ...

python file
Rectangle 27 174

Getting some sort of modification date in a cross-platform way is easy - just call os.path.getmtime(path) and you'll get the Unix timestamp of when the file at path was last modified.

Getting file creation dates, on the other hand, is fiddly and platform-dependent, differing even between the three big OSes:

os.path.getctime()
.st_ctime
os.stat()
ctime
  • On Mac, as well as some other Unix-based OSes, you can use the .st_birthtime attribute of the result of a call to os.stat().

On Linux, this is currently impossible, at least without writing a C extension for Python. Although some file systems commonly used with Linux do store creation dates (for example, ext4 stores them in st_crtime) , the Linux kernel offers no way of accessing them; in particular, the structs it returns from stat() calls in C, as of the latest kernel version, don't contain any creation date fields. You can also see that the identifier st_crtime doesn't currently feature anywhere in the Python source. At least if you're on ext4, the data is attached to the inodes in the file system, but there's no convenient way of accessing it.

The next-best thing on Linux is to access the file's mtime, through either os.path.getmtime() or the .st_mtime attribute of an os.stat() result. This will give you the last time the file's content was modified, which may be adequate for some use cases.

import os
import platform

def creation_date(path_to_file):
    """
    Try to get the date that a file was created, falling back to when it was
    last modified if that isn't possible.
    See http://stackoverflow.com/a/39501288/1709587 for explanation.
    """
    if platform.system() == 'Windows':
        return os.path.getctime(path_to_file)
    else:
        stat = os.stat(path_to_file)
        try:
            return stat.st_birthtime
        except AttributeError:
            # We're probably on Linux. No easy way to get creation dates here,
            # so we'll settle for when its content was last modified.
            return stat.st_mtime

I've done my best to throw this together (and spent a few hours researching in the process), and I'm sure it's at least more correct than the answers that were here previously, but this is a really hard topic and I'd appreciate any corrections, clarifications, or other input that people can offer. In particular, I'd like to construct a way of accessing this data on ext4 drives under Linux, and I'd like to learn what happens when Linux reads files written by Windows, or vica versa, given that they use st_ctime differently.

Frankly, file creation time is usually fairly useless. When you open an existing file for write with mode "w", it's not replacing it, it just opens the existing file and truncates it. Even though the file contents are completely unrelated to whatever it had on creation, you'd still be told the file was "created" well before the current version. Conversely, editors that use atomic replace on save (original file is replaced by new work-in-progress temp file) would show a more recent creation date, even if you just deleted one character. Use the modification time, don't grub for creation time.

After many years, I've finally found a use for file creation time! I'm writing code to check a file naming convention in certain directories, so first of all I want to consider files that were first named after the convention was instituted. Replacing the entire contents (mtime) is irrelevant: if it was already there then it's grandfathered in.

Hi Mark. I propose a simplification. On Linux, returning stat.st_ctime is more pertinent because, in many cases, the time of last metadata change can be the creation time (at least ctime is closer to the real creation time than mtime). Therefore, you could simply replace your snippet by stat = os.stat(path_to_file); try: return stat.st_birthtime; except AttributeError: return stat.st_ctime. What do you think? Cheers

@olibre "at least ctime is closer to the real creation time than mtime" - no it isn't; this is something I've seen stated several times but it's totally false. Unless you've manually messed with the values in your inode, ctime should always be equal to or later than mtime, because an mtime change causes a ctime change (because the mtime itself is considered "metadata"). See stackoverflow.com/a/39521489/1709587 where I provide some example code to illustrate this.

How to get file creation & modification date/times in Python? - Stack ...

python file
Rectangle 27 8

Right click on the top level folder in Source Control Explorer, select "Compare". Top option should be the server path e.g. $/TeamProject/Myfolder with the latest version selected in the dropdown. The bottom option should be c:\MyWorkspace\TeamProject\Myfolder this will do a compare with the latest version held in TFS with the files you have locally.

Or you could do the same thing using the tf diff command line tool.

visual studio - How to check files against TFS without getting latest?...

visual-studio visual-studio-2010 version-control tfs tfs2010
Rectangle 27 1

Even after deleting the .suo file and .vs folders, I had to edit the .sln file and remove the old relative url from SccProjectName# despite the SccLocalPath# being correct. Apparently VS also uses the name as a hint path.

caching - Visual Studio retrieving an incorrect path to a project from...

visual-studio caching tfs
Rectangle 27 63

I had same question for my file explorer activity. You should know that the contenturi for file only supports mediastore data like image, audio and video. I am giving you the code for getting image content uri from selecting an image from sdcard. Try this code, maybe it will work for you...

public static Uri getImageContentUri(Context context, File imageFile) {
  String filePath = imageFile.getAbsolutePath();
  Cursor cursor = context.getContentResolver().query(
      MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
      new String[] { MediaStore.Images.Media._ID },
      MediaStore.Images.Media.DATA + "=? ",
      new String[] { filePath }, null);
  if (cursor != null && cursor.moveToFirst()) {
    int id = cursor.getInt(cursor.getColumnIndex(MediaStore.MediaColumns._ID));
    cursor.close();
    return Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "" + id);
  } else {
    if (imageFile.exists()) {
      ContentValues values = new ContentValues();
      values.put(MediaStore.Images.Media.DATA, filePath);
      return context.getContentResolver().insert(
          MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
    } else {
      return null;
    }
  }
}

I was looking for a method to find the content:// URI of my recorded video file and the above code seems to work perfect on Nexus 4(Android 4.3). It would be nice if you can please explain the code.

I have tried this to get the Content Uri for a File with the Absolute path "/sdcard/Image Depo/picture.png". It didn't work, so i debuged the code path and found that the Cursor is empty, and when the entry is being added to ContentProvider, its giving null as the Content Uri. Please help.

This should be the accepted answer! Also this is the fix for Apps crashing in Android preview N (upcoming API level 24), when trying to take a photo with ACTION_IMAGE_CAPTURE using a file: Uri value for EXTRA_OUTPUT resulting in a FileUriExposedException. Just replace your putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(imageFile)) with putExtra(MediaStore.EXTRA_OUTPUT, getImageContentUri(context, imageFile)).

I have the file path - file:///storage/emulated/0/Android/data/com.packagename/files/out.mp4, but getting null when I try to get contentUri. I also tried changing MediaStore.Images.Media to MediaStore.Video.Media, but still no luck.

image - Get content uri from file path in android - Stack Overflow

android image
Rectangle 27 62

I had same question for my file explorer activity. You should know that the contenturi for file only supports mediastore data like image, audio and video. I am giving you the code for getting image content uri from selecting an image from sdcard. Try this code, maybe it will work for you...

public static Uri getImageContentUri(Context context, File imageFile) {
  String filePath = imageFile.getAbsolutePath();
  Cursor cursor = context.getContentResolver().query(
      MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
      new String[] { MediaStore.Images.Media._ID },
      MediaStore.Images.Media.DATA + "=? ",
      new String[] { filePath }, null);
  if (cursor != null && cursor.moveToFirst()) {
    int id = cursor.getInt(cursor.getColumnIndex(MediaStore.MediaColumns._ID));
    cursor.close();
    return Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "" + id);
  } else {
    if (imageFile.exists()) {
      ContentValues values = new ContentValues();
      values.put(MediaStore.Images.Media.DATA, filePath);
      return context.getContentResolver().insert(
          MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
    } else {
      return null;
    }
  }
}

I was looking for a method to find the content:// URI of my recorded video file and the above code seems to work perfect on Nexus 4(Android 4.3). It would be nice if you can please explain the code.

I have tried this to get the Content Uri for a File with the Absolute path "/sdcard/Image Depo/picture.png". It didn't work, so i debuged the code path and found that the Cursor is empty, and when the entry is being added to ContentProvider, its giving null as the Content Uri. Please help.

This should be the accepted answer! Also this is the fix for Apps crashing in Android preview N (upcoming API level 24), when trying to take a photo with ACTION_IMAGE_CAPTURE using a file: Uri value for EXTRA_OUTPUT resulting in a FileUriExposedException. Just replace your putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(imageFile)) with putExtra(MediaStore.EXTRA_OUTPUT, getImageContentUri(context, imageFile)).

I have the file path - file:///storage/emulated/0/Android/data/com.packagename/files/out.mp4, but getting null when I try to get contentUri. I also tried changing MediaStore.Images.Media to MediaStore.Video.Media, but still no luck.

image - Get content uri from file path in android - Stack Overflow

android image
Rectangle 27 9

For Visual Studio 2015 the steps in the above answers apply but the applicationhost.config file is in a new location. in your "solution" folder follow the path

\.vs\config

Alternatively you could just search your solution folder for the .config file and find it that way.

I personally used the following configuration:

With the following in my hosts file:

127.0.0.1       jam.net
127.0.0.1       www.jam.net

And the following in my applicationhost.config file:

<site name="JBN.Site" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\Dev\Jam\shoppingcart\src\Web\JBN.Site" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:49707:" />
            <binding protocol="http" bindingInformation="*:49707:localhost" /> 
    </bindings>
</site>

Remember to run your instance of visual studio 2015 as an administrator!

I hope this helps somebody, I had issues when trying to upgrade to visual studio 2015 and realized that none of my configurations were being carried over.

<binding protocol="http" bindingInformation="*:port#:" />
unable to connect to web server 'IIS Express'

make sure you run VS as Administrator

asp.net mvc - Change Project URL Visual Studio - Stack Overflow

asp.net-mvc visual-studio-2013
Rectangle 27 8

As far as I know, you can do something like this:

private Uri mImageCaptureUri;

public class AddEx extends Activity {
  static final int CAMERA_PIC_REQUEST = 1337; 
  public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.add);

    Button camera = (Button) findViewById(R.id.picButton);
    camera.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            Intent cameraIntent = 
                    new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
            cameraIntent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,
                    mImageCaptureUri);
            startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);               
        }               
    });

}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == CAMERA_PIC_REQUEST) {  
        Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
        ImageView image = (ImageView) findViewById(R.id.returnedPic);  
        image.setImageBitmap(thumbnail);  

        String pathToImage = mImageCaptureUri.getPath();

        // pathToImage is a path you need. 

        // If image file is not in there, 
        //  you can save it yourself manually with this code:
        File file = new File(mImageCaptureUri.getPath());
        FileOutputStream fOut = new FileOutputStream(file);
        bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fOut); // You can choose any format you want
    }  
}

The name of the Intent-extra used to indicate a content resolver Uri to be used to store the requested image or video.

android - Getting the file path from a picture in ImageView - Stack Ov...

android image camera
Rectangle 27 3

You need to set the include file path (and possibly other things). At the command line this is typically done using a batch file that Visual Studio installs called vsvars32.bat (or vcvars32.bat for compatibility with VC6).

I'm not familiar with scons so I don't know the best way to get these settings configured for that tool, but for standard makefiles there's usually a line in the makefile which sets a macro variable with the include directory path and that macro is used as part of a command line parameter in the command that invokes the compiler.

Another possibility might be to have the scons process invoke vsvars32.bat or run the scons script from a command line that has been configured with the batch file.

In short you need to get the things that vsvars32.bat configures into the scons configuration somehow.

I can confirm that this is the process that our team normally use when working with SCons on windows.

Andrew, can you further explain how do you include vcvars32 in scons?

visual c++ - fatal error C1083: Cannot open include file: 'Windows.h':...

visual-c++ path environment scons include